mirror of https://github.com/axmolengine/axmol.git
add constness to some function
This commit is contained in:
parent
8a463e7964
commit
87455b0ecb
|
@ -332,7 +332,7 @@ Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json)
|
||||||
|
|
||||||
const char* texture = DICTOOL->getStringValue_json(json, Value);
|
const char* texture = DICTOOL->getStringValue_json(json, Value);
|
||||||
|
|
||||||
if(texture != NULL)
|
if(texture != nullptr)
|
||||||
{
|
{
|
||||||
std::string path = texture;
|
std::string path = texture;
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ Frame* ActionTimelineCache::loadEventFrame(const rapidjson::Value& json)
|
||||||
|
|
||||||
const char* evnt = DICTOOL->getStringValue_json(json, Value);
|
const char* evnt = DICTOOL->getStringValue_json(json, Value);
|
||||||
|
|
||||||
if(evnt != NULL)
|
if(evnt != nullptr)
|
||||||
frame->setEvent(evnt);
|
frame->setEvent(evnt);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
|
|
|
@ -84,7 +84,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
||||||
cocos2d::Vector<ActionObject*> actionList;
|
cocos2d::Vector<ActionObject*> actionList;
|
||||||
|
|
||||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
||||||
stExpCocoNode *actionNode = NULL;
|
stExpCocoNode *actionNode = nullptr;
|
||||||
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
|
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
|
||||||
std::string key = stChildArray[i].GetName(cocoLoader);
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
if (key == "actionlist") {
|
if (key == "actionlist") {
|
||||||
|
@ -92,7 +92,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NULL != actionNode)
|
if (nullptr != actionNode)
|
||||||
{
|
{
|
||||||
int actionCount = actionNode->GetChildNum();
|
int actionCount = actionNode->GetChildNum();
|
||||||
for (int i = 0; i < actionCount; ++i) {
|
for (int i = 0; i < actionCount; ++i) {
|
||||||
|
|
|
@ -169,11 +169,11 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
initActionNodeFromRoot(root);
|
initActionNodeFromRoot(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionNode::valueToInt(std::string& value)
|
int ActionNode::valueToInt(const std::string& value)
|
||||||
{
|
{
|
||||||
return atoi(value.c_str());
|
return atoi(value.c_str());
|
||||||
}
|
}
|
||||||
bool ActionNode::valueToBool(std::string& value)
|
bool ActionNode::valueToBool(const std::string& value)
|
||||||
{
|
{
|
||||||
int intValue = valueToInt(value);
|
int intValue = valueToInt(value);
|
||||||
if (1 == intValue) {
|
if (1 == intValue) {
|
||||||
|
@ -182,7 +182,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float ActionNode::valueToFloat(std::string& value)
|
float ActionNode::valueToFloat(const std::string& value)
|
||||||
{
|
{
|
||||||
return atof(value.c_str());
|
return atof(value.c_str());
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
|
|
||||||
int actionNodeCount = stChildNode->GetChildNum();
|
int actionNodeCount = stChildNode->GetChildNum();
|
||||||
stChildNode = stChildNode[0].GetChildArray();
|
stChildNode = stChildNode[0].GetChildArray();
|
||||||
stExpCocoNode *frameListNode = NULL;
|
stExpCocoNode *frameListNode = nullptr;
|
||||||
for (int i = 0; i < actionNodeCount; ++i) {
|
for (int i = 0; i < actionNodeCount; ++i) {
|
||||||
std::string key = stChildNode[i].GetName(cocoLoader);
|
std::string key = stChildNode[i].GetName(cocoLoader);
|
||||||
std::string value = stChildNode[i].GetValue();
|
std::string value = stChildNode[i].GetValue();
|
||||||
|
|
|
@ -160,9 +160,9 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool isActionDoneOnce();
|
virtual bool isActionDoneOnce();
|
||||||
protected:
|
protected:
|
||||||
int valueToInt(std::string& value);
|
int valueToInt(const std::string& value);
|
||||||
bool valueToBool(std::string& value);
|
bool valueToBool(const std::string& value);
|
||||||
float valueToFloat(std::string& value);
|
float valueToFloat(const std::string& value);
|
||||||
|
|
||||||
int _currentFrameIndex;
|
int _currentFrameIndex;
|
||||||
int _destFrameIndex;
|
int _destFrameIndex;
|
||||||
|
|
|
@ -133,7 +133,7 @@ void ActionObject::initWithBinary(CocoLoader *cocoLoader,
|
||||||
cocos2d::Ref *root)
|
cocos2d::Ref *root)
|
||||||
{
|
{
|
||||||
stExpCocoNode *stChildNode = cocoNode->GetChildArray();
|
stExpCocoNode *stChildNode = cocoNode->GetChildArray();
|
||||||
stExpCocoNode *actionNodeList = NULL;
|
stExpCocoNode *actionNodeList = nullptr;
|
||||||
int count = cocoNode->GetChildNum();
|
int count = cocoNode->GetChildNum();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
std::string key = stChildNode[i].GetName(cocoLoader);
|
std::string key = stChildNode[i].GetName(cocoLoader);
|
||||||
|
@ -149,7 +149,7 @@ void ActionObject::initWithBinary(CocoLoader *cocoLoader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(NULL != actionNodeList)
|
if(nullptr != actionNodeList)
|
||||||
{
|
{
|
||||||
int actionNodeCount = actionNodeList->GetChildNum();
|
int actionNodeCount = actionNodeList->GetChildNum();
|
||||||
stExpCocoNode *actionNodeArray = actionNodeList->GetChildArray();
|
stExpCocoNode *actionNodeArray = actionNodeList->GetChildArray();
|
||||||
|
@ -174,11 +174,11 @@ void ActionObject::initWithBinary(CocoLoader *cocoLoader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionObject::valueToInt(std::string& value)
|
int ActionObject::valueToInt(const std::string& value)
|
||||||
{
|
{
|
||||||
return atoi(value.c_str());
|
return atoi(value.c_str());
|
||||||
}
|
}
|
||||||
bool ActionObject::valueToBool(std::string& value)
|
bool ActionObject::valueToBool(const std::string& value)
|
||||||
{
|
{
|
||||||
int intValue = valueToInt(value);
|
int intValue = valueToInt(value);
|
||||||
if (1 == intValue) {
|
if (1 == intValue) {
|
||||||
|
@ -187,7 +187,7 @@ bool ActionObject::valueToBool(std::string& value)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float ActionObject::valueToFloat(std::string& value)
|
float ActionObject::valueToFloat(const std::string& value)
|
||||||
{
|
{
|
||||||
return atof(value.c_str());
|
return atof(value.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,9 +170,9 @@ public:
|
||||||
/*scheduler update function*/
|
/*scheduler update function*/
|
||||||
void simulationActionUpdate(float dt);
|
void simulationActionUpdate(float dt);
|
||||||
protected:
|
protected:
|
||||||
int valueToInt(std::string& value);
|
int valueToInt(const std::string& value);
|
||||||
bool valueToBool(std::string& value);
|
bool valueToBool(const std::string& value);
|
||||||
float valueToFloat(std::string& value);
|
float valueToFloat(const std::string& value);
|
||||||
|
|
||||||
cocos2d::Vector<ActionNode*> _actionNodeList;
|
cocos2d::Vector<ActionNode*> _actionNodeList;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
|
|
@ -1405,7 +1405,7 @@ DisplayData *DataReaderHelper::decodeBoneDisplay(const rapidjson::Value& json, D
|
||||||
displayData = new SpriteDisplayData();
|
displayData = new SpriteDisplayData();
|
||||||
|
|
||||||
const char *name = DICTOOL->getStringValue_json(json, A_NAME);
|
const char *name = DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
if(name != NULL)
|
if(name != nullptr)
|
||||||
{
|
{
|
||||||
((SpriteDisplayData *)displayData)->displayName = name;
|
((SpriteDisplayData *)displayData)->displayName = name;
|
||||||
}
|
}
|
||||||
|
@ -1823,7 +1823,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Auto losprite file
|
// Auto losprite file
|
||||||
bool autoLoad = dataInfo->asyncStruct == NULL ? ArmatureDataManager::getInstance()->isAutoLoadSpriteFile() : dataInfo->asyncStruct->autoLoadSpriteFile;
|
bool autoLoad = dataInfo->asyncStruct == nullptr ? ArmatureDataManager::getInstance()->isAutoLoadSpriteFile() : dataInfo->asyncStruct->autoLoadSpriteFile;
|
||||||
if (autoLoad)
|
if (autoLoad)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nCount; ++i)
|
for (int i = 0; i < nCount; ++i)
|
||||||
|
@ -1838,7 +1838,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
for (int ii = 0; ii < length; ii++)
|
for (int ii = 0; ii < length; ii++)
|
||||||
{
|
{
|
||||||
const char *path = pConfigFilePath[ii].GetValue();
|
const char *path = pConfigFilePath[ii].GetValue();
|
||||||
if (path == NULL)
|
if (path == nullptr)
|
||||||
{
|
{
|
||||||
CCLOG("load CONFIG_FILE_PATH error.");
|
CCLOG("load CONFIG_FILE_PATH error.");
|
||||||
return;
|
return;
|
||||||
|
@ -1871,7 +1871,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
armatureData->init();
|
armatureData->init();
|
||||||
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray();
|
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray();
|
||||||
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
|
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
if(name != NULL)
|
if(name != nullptr)
|
||||||
{
|
{
|
||||||
armatureData->name = name;
|
armatureData->name = name;
|
||||||
}
|
}
|
||||||
|
@ -1904,7 +1904,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
int length = cocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray();
|
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray();
|
||||||
stExpCocoNode* child;
|
stExpCocoNode* child;
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
std::string key;
|
std::string key;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1914,7 +1914,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
//DICTOOL->getStringValue_json(json, A_NAME);
|
//DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
boneData->name = str;
|
boneData->name = str;
|
||||||
}
|
}
|
||||||
|
@ -1922,7 +1922,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_PARENT) == 0)
|
else if (key.compare(A_PARENT) == 0)
|
||||||
{
|
{
|
||||||
//DICTOOL->getStringValue_json(json, A_PARENT);
|
//DICTOOL->getStringValue_json(json, A_PARENT);
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
boneData->parentName = str;
|
boneData->parentName = str;
|
||||||
}
|
}
|
||||||
|
@ -1934,7 +1934,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
for (int ii = 0; ii < count; ++ii)
|
for (int ii = 0; ii < count; ++ii)
|
||||||
{
|
{
|
||||||
DisplayData *displayData = decodeBoneDisplay(cocoLoader, &pDisplayData[ii], dataInfo);
|
DisplayData *displayData = decodeBoneDisplay(cocoLoader, &pDisplayData[ii], dataInfo);
|
||||||
if(displayData == NULL)
|
if(displayData == nullptr)
|
||||||
continue;
|
continue;
|
||||||
boneData->addDisplayData(displayData);
|
boneData->addDisplayData(displayData);
|
||||||
displayData->release();
|
displayData->release();
|
||||||
|
@ -1949,11 +1949,11 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
{
|
{
|
||||||
stExpCocoNode* children = cocoNode->GetChildArray();
|
stExpCocoNode* children = cocoNode->GetChildArray();
|
||||||
stExpCocoNode* child = &children[1];
|
stExpCocoNode* child = &children[1];
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
|
|
||||||
std::string key = child->GetName(cocoLoader);
|
std::string key = child->GetName(cocoLoader);
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
DisplayData *displayData = NULL;
|
DisplayData *displayData = nullptr;
|
||||||
if (key.compare(A_DISPLAY_TYPE) == 0)
|
if (key.compare(A_DISPLAY_TYPE) == 0)
|
||||||
{
|
{
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
|
@ -1967,15 +1967,15 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
displayData = new SpriteDisplayData();
|
displayData = new SpriteDisplayData();
|
||||||
|
|
||||||
const char *name = children[0].GetValue();
|
const char *name = children[0].GetValue();
|
||||||
if(name != NULL)
|
if(name != nullptr)
|
||||||
{
|
{
|
||||||
((SpriteDisplayData *)displayData)->displayName = name;
|
((SpriteDisplayData *)displayData)->displayName = name;
|
||||||
}
|
}
|
||||||
stExpCocoNode *pSkinDataArray = children[2].GetChildArray();
|
stExpCocoNode *pSkinDataArray = children[2].GetChildArray();
|
||||||
if (pSkinDataArray != NULL)
|
if (pSkinDataArray != nullptr)
|
||||||
{
|
{
|
||||||
stExpCocoNode *pSkinData = &pSkinDataArray[0];
|
stExpCocoNode *pSkinData = &pSkinDataArray[0];
|
||||||
if (pSkinData != NULL)
|
if (pSkinData != nullptr)
|
||||||
{
|
{
|
||||||
SpriteDisplayData *sdd = (SpriteDisplayData *)displayData;
|
SpriteDisplayData *sdd = (SpriteDisplayData *)displayData;
|
||||||
length = pSkinData->GetChildNum();
|
length = pSkinData->GetChildNum();
|
||||||
|
@ -2022,7 +2022,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
displayData = new ArmatureDisplayData();
|
displayData = new ArmatureDisplayData();
|
||||||
|
|
||||||
const char *name = cocoNode[0].GetValue();
|
const char *name = cocoNode[0].GetValue();
|
||||||
if(name != NULL)
|
if(name != nullptr)
|
||||||
{
|
{
|
||||||
((ArmatureDisplayData *)displayData)->displayName = name;
|
((ArmatureDisplayData *)displayData)->displayName = name;
|
||||||
}
|
}
|
||||||
|
@ -2040,7 +2040,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
if (key.compare(A_PLIST) == 0)
|
if (key.compare(A_PLIST) == 0)
|
||||||
{
|
{
|
||||||
const char *plist = str;
|
const char *plist = str;
|
||||||
if(plist != NULL)
|
if(plist != nullptr)
|
||||||
{
|
{
|
||||||
if (dataInfo->asyncStruct)
|
if (dataInfo->asyncStruct)
|
||||||
{
|
{
|
||||||
|
@ -2071,7 +2071,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
|
|
||||||
int length = cocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pAnimationData = cocoNode->GetChildArray();
|
stExpCocoNode *pAnimationData = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
std::string key;
|
std::string key;
|
||||||
stExpCocoNode* child;
|
stExpCocoNode* child;
|
||||||
MovementData *movementData;
|
MovementData *movementData;
|
||||||
|
@ -2082,7 +2082,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
aniData->name = str;
|
aniData->name = str;
|
||||||
}
|
}
|
||||||
|
@ -2110,7 +2110,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
int length = cocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray();
|
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
std::string key;
|
std::string key;
|
||||||
stExpCocoNode* child;
|
stExpCocoNode* child;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
|
@ -2120,7 +2120,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
str = child->GetValue();
|
str = child->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementData->name = str;
|
movementData->name = str;
|
||||||
}
|
}
|
||||||
|
@ -2128,7 +2128,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_LOOP) == 0)
|
else if (key.compare(A_LOOP) == 0)
|
||||||
{
|
{
|
||||||
movementData->loop = true;
|
movementData->loop = true;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
if (strcmp("1", str) != 0)
|
if (strcmp("1", str) != 0)
|
||||||
{
|
{
|
||||||
|
@ -2139,7 +2139,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_DURATION_TWEEN) == 0)
|
else if (key.compare(A_DURATION_TWEEN) == 0)
|
||||||
{
|
{
|
||||||
movementData->durationTween = 0;
|
movementData->durationTween = 0;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementData->durationTween = atoi(str);
|
movementData->durationTween = atoi(str);
|
||||||
}
|
}
|
||||||
|
@ -2147,7 +2147,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_DURATION_TO) == 0)
|
else if (key.compare(A_DURATION_TO) == 0)
|
||||||
{
|
{
|
||||||
movementData->durationTo = 0;
|
movementData->durationTo = 0;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementData->durationTo = atoi(str);
|
movementData->durationTo = atoi(str);
|
||||||
}
|
}
|
||||||
|
@ -2155,7 +2155,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_DURATION) == 0)
|
else if (key.compare(A_DURATION) == 0)
|
||||||
{
|
{
|
||||||
movementData->duration = 0;
|
movementData->duration = 0;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementData->duration = atoi(str);
|
movementData->duration = atoi(str);
|
||||||
}
|
}
|
||||||
|
@ -2163,7 +2163,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_MOVEMENT_SCALE) == 0)
|
else if (key.compare(A_MOVEMENT_SCALE) == 0)
|
||||||
{
|
{
|
||||||
movementData->scale = 1.0;
|
movementData->scale = 1.0;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementData->scale = atof(str);
|
movementData->scale = atof(str);
|
||||||
}
|
}
|
||||||
|
@ -2171,7 +2171,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_TWEEN_EASING) == 0)
|
else if (key.compare(A_TWEEN_EASING) == 0)
|
||||||
{
|
{
|
||||||
movementData->tweenEasing = cocos2d::tweenfunc::Linear;
|
movementData->tweenEasing = cocos2d::tweenfunc::Linear;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementData->tweenEasing = (TweenType)(atoi(str));
|
movementData->tweenEasing = (TweenType)(atoi(str));
|
||||||
}
|
}
|
||||||
|
@ -2200,7 +2200,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
int length = cocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray();
|
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray();
|
||||||
stExpCocoNode* movebonechild;
|
stExpCocoNode* movebonechild;
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
movebonechild = &pMovementBoneDataArray[i];
|
movebonechild = &pMovementBoneDataArray[i];
|
||||||
|
@ -2208,14 +2208,14 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
str = movebonechild->GetValue();
|
str = movebonechild->GetValue();
|
||||||
if (key.compare(A_NAME) == 0)
|
if (key.compare(A_NAME) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementBoneData->name = str;
|
movementBoneData->name = str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key.compare(A_MOVEMENT_DELAY) == 0)
|
else if (key.compare(A_MOVEMENT_DELAY) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
movementBoneData->delay = atof(str);
|
movementBoneData->delay = atof(str);
|
||||||
}
|
}
|
||||||
|
@ -2294,7 +2294,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
|
|
||||||
int length = cocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray();
|
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
{
|
{
|
||||||
std::string key = pFrameDataArray[i].GetName(cocoLoader);
|
std::string key = pFrameDataArray[i].GetName(cocoLoader);
|
||||||
|
@ -2302,28 +2302,28 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
if (key.compare(A_TWEEN_EASING) == 0)
|
if (key.compare(A_TWEEN_EASING) == 0)
|
||||||
{
|
{
|
||||||
frameData->tweenEasing = cocos2d::tweenfunc::Linear;
|
frameData->tweenEasing = cocos2d::tweenfunc::Linear;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->tweenEasing = (TweenType)(atoi(str));
|
frameData->tweenEasing = (TweenType)(atoi(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key.compare(A_DISPLAY_INDEX) == 0)
|
else if (key.compare(A_DISPLAY_INDEX) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->displayIndex = atoi(str);
|
frameData->displayIndex = atoi(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key.compare(A_BLEND_SRC) == 0)
|
else if (key.compare(A_BLEND_SRC) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->blendFunc.src = (GLenum)(atoi(str));
|
frameData->blendFunc.src = (GLenum)(atoi(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key.compare(A_BLEND_DST) == 0)
|
else if (key.compare(A_BLEND_DST) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->blendFunc.dst = (GLenum)(atoi(str));
|
frameData->blendFunc.dst = (GLenum)(atoi(str));
|
||||||
}
|
}
|
||||||
|
@ -2331,7 +2331,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
else if (key.compare(A_TWEEN_FRAME) == 0)
|
else if (key.compare(A_TWEEN_FRAME) == 0)
|
||||||
{
|
{
|
||||||
frameData->isTween = true;
|
frameData->isTween = true;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
if (strcmp("1", str) != 0)
|
if (strcmp("1", str) != 0)
|
||||||
{
|
{
|
||||||
|
@ -2341,7 +2341,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
}
|
}
|
||||||
else if (key.compare(A_EVENT) == 0)
|
else if (key.compare(A_EVENT) == 0)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->strEvent = str;
|
frameData->strEvent = str;
|
||||||
}
|
}
|
||||||
|
@ -2351,7 +2351,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
if (dataInfo->cocoStudioVersion < VERSION_COMBINED)
|
if (dataInfo->cocoStudioVersion < VERSION_COMBINED)
|
||||||
{
|
{
|
||||||
frameData->duration = 1;
|
frameData->duration = 1;
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->duration = atoi(str);
|
frameData->duration = atoi(str);
|
||||||
}
|
}
|
||||||
|
@ -2361,7 +2361,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
{
|
{
|
||||||
if (dataInfo->cocoStudioVersion >= VERSION_COMBINED)
|
if (dataInfo->cocoStudioVersion >= VERSION_COMBINED)
|
||||||
{
|
{
|
||||||
if(str != NULL)
|
if(str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->frameID = atoi(str);
|
frameData->frameID = atoi(str);
|
||||||
}
|
}
|
||||||
|
@ -2377,7 +2377,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
for (int ii = 0; ii < count; ++ii)
|
for (int ii = 0; ii < count; ++ii)
|
||||||
{
|
{
|
||||||
str = pFrameData[ii].GetValue();
|
str = pFrameData[ii].GetValue();
|
||||||
if (str != NULL)
|
if (str != nullptr)
|
||||||
{
|
{
|
||||||
frameData->easingParams[ii] = atof(str);
|
frameData->easingParams[ii] = atof(str);
|
||||||
}
|
}
|
||||||
|
@ -2491,7 +2491,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
{
|
{
|
||||||
int length = cocoNode->GetChildNum();
|
int length = cocoNode->GetChildNum();
|
||||||
stExpCocoNode *NodeArray = cocoNode->GetChildArray();
|
stExpCocoNode *NodeArray = cocoNode->GetChildArray();
|
||||||
const char *str = NULL;
|
const char *str = nullptr;
|
||||||
|
|
||||||
bool isVersionL = dataInfo->cocoStudioVersion < VERSION_COLOR_READING;
|
bool isVersionL = dataInfo->cocoStudioVersion < VERSION_COLOR_READING;
|
||||||
stExpCocoNode* child;
|
stExpCocoNode* child;
|
||||||
|
|
|
@ -179,7 +179,7 @@ public:
|
||||||
|
|
||||||
// for binary decode
|
// for binary decode
|
||||||
public:
|
public:
|
||||||
static void addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo = NULL);
|
static void addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo = nullptr);
|
||||||
static ArmatureData *decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static ArmatureData *decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static BoneData *decodeBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static BoneData *decodeBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
static DisplayData *decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
static DisplayData *decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace cocostudio
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ButtonReader* instanceButtonReader = NULL;
|
static ButtonReader* instanceButtonReader = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ButtonReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ButtonReader)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
static PageViewReader* instancePageViewReader = NULL;
|
static PageViewReader* instancePageViewReader = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(PageViewReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(PageViewReader)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace cocostudio
|
||||||
static const char* P_Direction = "direction";
|
static const char* P_Direction = "direction";
|
||||||
static const char* P_BounceEnable = "bounceEnable";
|
static const char* P_BounceEnable = "bounceEnable";
|
||||||
|
|
||||||
static ScrollViewReader* instanceScrollViewReader = NULL;
|
static ScrollViewReader* instanceScrollViewReader = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader)
|
||||||
|
|
||||||
|
|
|
@ -73,11 +73,11 @@ namespace cocostudio
|
||||||
_positionPercentY(0.0f),
|
_positionPercentY(0.0f),
|
||||||
_opacity(255)
|
_opacity(255)
|
||||||
{
|
{
|
||||||
valueToInt = [=](std::string str) -> int{
|
valueToInt = [=](const std::string& str) -> int{
|
||||||
return atoi(str.c_str());
|
return atoi(str.c_str());
|
||||||
};
|
};
|
||||||
|
|
||||||
valueToBool = [=](std::string str) -> bool{
|
valueToBool = [=](const std::string& str) -> bool{
|
||||||
int intValue = valueToInt(str);
|
int intValue = valueToInt(str);
|
||||||
if (1 == intValue) {
|
if (1 == intValue) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -86,7 +86,7 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
valueToFloat = [=](std::string str) -> float{
|
valueToFloat = [=](const std::string& str) -> float{
|
||||||
return atof(str.c_str());
|
return atof(str.c_str());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,9 @@ namespace cocostudio
|
||||||
void endSetBasicProperties(cocos2d::ui::Widget *widget);
|
void endSetBasicProperties(cocos2d::ui::Widget *widget);
|
||||||
|
|
||||||
|
|
||||||
std::function<int(std::string)> valueToInt;
|
std::function<int(const std::string&)> valueToInt;
|
||||||
std::function<bool(std::string)> valueToBool;
|
std::function<bool(const std::string&)> valueToBool;
|
||||||
std::function<float(std::string)> valueToFloat;
|
std::function<float(const std::string&)> valueToFloat;
|
||||||
|
|
||||||
float _sizePercentX;
|
float _sizePercentX;
|
||||||
float _sizePercentY;
|
float _sizePercentY;
|
||||||
|
|
Loading…
Reference in New Issue