mirror of https://github.com/axmolengine/axmol.git
Switched from std::string to const char *.
This commit is contained in:
parent
d3e0f8dc92
commit
420a731138
|
@ -9,8 +9,8 @@ CCNode * CCBFileLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|||
return CCNode::node();
|
||||
}
|
||||
|
||||
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_CCBFILE) == 0) {
|
||||
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_CCBFILE) == 0) {
|
||||
pNode->addChild(pCCBFileNode);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
|
||||
|
|
|
@ -12,7 +12,7 @@ class CCBFileLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCNode * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeCCBFile(CCNode *, CCNode *, std::string, CCNode *, CCBReader *);
|
||||
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode *, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -68,8 +68,8 @@ CCBReader::CCBReader(CCBReader * pCCBReader) {
|
|||
this->mCCBSelectorResolver = pCCBReader->mCCBSelectorResolver;
|
||||
}
|
||||
|
||||
void CCBReader::registerCCNodeLoader(std::string pClassName, CCNodeLoader * pCCNodeLoader) {
|
||||
this->mCCNodeLoaders.insert(std::pair<std::string, CCNodeLoader *>(pClassName, pCCNodeLoader));
|
||||
void CCBReader::registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader) {
|
||||
this->mCCNodeLoaders.insert(std::pair<const char *, CCNodeLoader *>(pClassName, pCCNodeLoader));
|
||||
}
|
||||
|
||||
CCBMemberVariableAssigner * CCBReader::getCCBMemberVariableAssigner() {
|
||||
|
@ -84,8 +84,8 @@ float CCBReader::getResolutionScale() {
|
|||
return this->mResolutionScale;
|
||||
}
|
||||
|
||||
CCNodeLoader * CCBReader::getCCNodeLoader(std::string pClassName) {
|
||||
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
|
||||
CCNodeLoader * CCBReader::getCCNodeLoader(const char * pClassName) {
|
||||
std::map<const char *, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
|
||||
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
|
||||
return ccNodeLoadersIterator->second;
|
||||
}
|
||||
|
@ -144,25 +144,26 @@ bool CCBReader::readStringCache() {
|
|||
int numStrings = this->readInt(false);
|
||||
|
||||
for(int i = 0; i < numStrings; i++) {
|
||||
std::string string = this->readUTF8();
|
||||
this->mStringCache.push_back(string);
|
||||
this->readStringCacheEntry();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CCBReader::readUTF8() {
|
||||
void CCBReader::readStringCacheEntry() {
|
||||
int b0 = this->readByte();
|
||||
int b1 = this->readByte();
|
||||
|
||||
int numBytes = b0 << 8 | b1;
|
||||
|
||||
const char * ptr = (const char*) (this->mBytes + this->mCurrentByte);
|
||||
std::string str(ptr, numBytes);
|
||||
const char * src = (const char *) (this->mBytes + this->mCurrentByte);
|
||||
char * ptr = new char[numBytes + 1]; // TODO I'm most likely leaking memory here. Unfortunately I'm not sure if I can safely delete the items in the mStringCache in ~CCBReader. =(
|
||||
strncpy(ptr, src, numBytes);
|
||||
ptr[numBytes] = '\0';
|
||||
|
||||
this->mCurrentByte += numBytes;
|
||||
|
||||
return str;
|
||||
this->mStringCache.push_back(ptr);
|
||||
}
|
||||
|
||||
unsigned char CCBReader::readByte() {
|
||||
|
@ -260,17 +261,17 @@ void CCBReader::alignBits() {
|
|||
}
|
||||
}
|
||||
|
||||
std::string CCBReader::readCachedString() {
|
||||
const char * CCBReader::readCachedString() {
|
||||
int i = this->readInt(false);
|
||||
return this->mStringCache[i];
|
||||
}
|
||||
|
||||
CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
|
||||
/* Read class name. */
|
||||
std::string className = this->readCachedString();
|
||||
const char * className = this->readCachedString();
|
||||
|
||||
int memberVarAssignmentType = this->readInt(false);
|
||||
std::string memberVarAssignmentName;
|
||||
const char * memberVarAssignmentName;
|
||||
if(memberVarAssignmentType != kCCBTargetTypeNone) {
|
||||
memberVarAssignmentName = this->readCachedString();
|
||||
}
|
||||
|
@ -335,39 +336,47 @@ CCSize CCBReader::getContainerSize(CCNode * pNode) {
|
|||
}
|
||||
}
|
||||
|
||||
std::string CCBReader::lastPathComponent(std::string pPath) {
|
||||
int slashPos = pPath.find_last_of("/");
|
||||
if (slashPos != std::string::npos) {
|
||||
return pPath.substr(slashPos + 1, pPath.length() - slashPos);
|
||||
}
|
||||
return pPath;
|
||||
}
|
||||
|
||||
std::string CCBReader::deletePathExtension(std::string pPath) {
|
||||
int dotPos = pPath.find_last_of(".");
|
||||
if (dotPos != std::string::npos) {
|
||||
return pPath.substr(0, dotPos);
|
||||
}
|
||||
return pPath;
|
||||
}
|
||||
|
||||
bool CCBReader::isSpriteSheetLoaded(std::string pSpriteSheet) {
|
||||
bool CCBReader::isSpriteSheetLoaded(const char * pSpriteSheet) {
|
||||
return this->mLoadedSpriteSheets.find(pSpriteSheet) != this->mLoadedSpriteSheets.end();
|
||||
}
|
||||
|
||||
void CCBReader::addLoadedSpriteSheet(std::string pSpriteSheet) {
|
||||
void CCBReader::addLoadedSpriteSheet(const char * pSpriteSheet) {
|
||||
this->mLoadedSpriteSheets.insert(pSpriteSheet);
|
||||
}
|
||||
|
||||
std::string CCBReader::toLowerCase(std::string pString) {
|
||||
std::string copy(pString);
|
||||
std::transform(copy.begin(), copy.end(), copy.begin(), ::tolower);
|
||||
return copy;
|
||||
const char * CCBReader::lastPathComponent(const char * pPath) {
|
||||
// TODO Memory leaks?
|
||||
std::string path(pPath);
|
||||
int slashPos = path.find_last_of("/");
|
||||
if (slashPos != std::string::npos) {
|
||||
return path.substr(slashPos + 1, path.length() - slashPos).c_str();
|
||||
}
|
||||
return pPath;
|
||||
}
|
||||
|
||||
bool CCBReader::endsWith(std::string pString, std::string pEnding) {
|
||||
if (pString.length() >= pEnding.length()) {
|
||||
return (pString.compare(pString.length() - pEnding.length(), pEnding.length(), pEnding) == 0);
|
||||
const char * CCBReader::deletePathExtension(const char * pPath) {
|
||||
// TODO Memory leaks?
|
||||
std::string path(pPath);
|
||||
int dotPos = path.find_last_of(".");
|
||||
if (dotPos != std::string::npos) {
|
||||
return path.substr(0, dotPos).c_str();
|
||||
}
|
||||
return pPath;
|
||||
}
|
||||
|
||||
const char * CCBReader::toLowerCase(const char * pString) {
|
||||
// TODO Memory leaks?
|
||||
std::string copy(pString);
|
||||
std::transform(copy.begin(), copy.end(), copy.begin(), ::tolower);
|
||||
return copy.c_str();
|
||||
}
|
||||
|
||||
bool CCBReader::endsWith(const char * pString, const char * pEnding) {
|
||||
// TODO Memory leaks?
|
||||
std::string string(pString);
|
||||
std::string ending(pEnding);
|
||||
if (string.length() >= ending.length()) {
|
||||
return (string.compare(string.length() - ending.length(), ending.length(), ending) == 0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,12 @@
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
struct cmp_str {
|
||||
bool operator() (char const *a, char const *b) {
|
||||
return std::strcmp(a, b) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
/* Forward declaration. */
|
||||
class CCNodeLoader;
|
||||
|
||||
|
@ -87,9 +93,9 @@ class CC_DLL CCBReader : public CCObject { // TODO Why extend CCObject? -> Also
|
|||
CCBMemberVariableAssigner * mCCBMemberVariableAssigner;
|
||||
CCBSelectorResolver * mCCBSelectorResolver;
|
||||
|
||||
std::vector<std::string> mStringCache;
|
||||
std::map<std::string, CCNodeLoader *> mCCNodeLoaders;
|
||||
std::set<std::string> mLoadedSpriteSheets;
|
||||
std::vector<const char *> mStringCache;
|
||||
std::map<const char *, CCNodeLoader *, cmp_str> mCCNodeLoaders;
|
||||
std::set<const char *, cmp_str> mLoadedSpriteSheets;
|
||||
|
||||
public:
|
||||
/* Constructor. */
|
||||
|
@ -100,8 +106,8 @@ class CC_DLL CCBReader : public CCObject { // TODO Why extend CCObject? -> Also
|
|||
|
||||
CCNode * readNodeGraphFromFile(const char * pCCBFileName, CCObject * pOwner = NULL);
|
||||
CCNode * readNodeGraphFromFile(const char * pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize);
|
||||
void registerCCNodeLoader(std::string pClassName, CCNodeLoader * pCCNodeLoader);
|
||||
CCNodeLoader * getCCNodeLoader(std::string pClassName);
|
||||
void registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader);
|
||||
CCNodeLoader * getCCNodeLoader(const char * pClassName);
|
||||
CCBMemberVariableAssigner * getCCBMemberVariableAssigner();
|
||||
CCBSelectorResolver * getCCBSelectorResolver();
|
||||
|
||||
|
@ -110,31 +116,32 @@ class CC_DLL CCBReader : public CCObject { // TODO Why extend CCObject? -> Also
|
|||
CCSize getContainerSize(CCNode *);
|
||||
float getResolutionScale();
|
||||
|
||||
bool isSpriteSheetLoaded(std::string);
|
||||
void addLoadedSpriteSheet(std::string);
|
||||
bool isSpriteSheetLoaded(const char *);
|
||||
void addLoadedSpriteSheet(const char *);
|
||||
|
||||
/* Utility methods. */
|
||||
std::string lastPathComponent(std::string);
|
||||
std::string deletePathExtension(std::string);
|
||||
std::string toLowerCase(std::string);
|
||||
bool endsWith(std::string, std::string);
|
||||
const char * lastPathComponent(const char *);
|
||||
const char * deletePathExtension(const char *);
|
||||
const char * toLowerCase(const char *);
|
||||
bool endsWith(const char *, const char *);
|
||||
|
||||
/* Parse methods. */
|
||||
int readInt(bool pSign);
|
||||
unsigned char readByte();
|
||||
bool readBool();
|
||||
float readFloat();
|
||||
std::string readCachedString();
|
||||
const char * readCachedString();
|
||||
|
||||
private:
|
||||
bool readHeader();
|
||||
bool readStringCache();
|
||||
void readStringCacheEntry();
|
||||
CCNode * readNodeGraph();
|
||||
CCNode * readNodeGraph(CCNode *);
|
||||
|
||||
bool getBit();
|
||||
void alignBits();
|
||||
std::string readUTF8();
|
||||
const char * readUTF8();
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -26,76 +26,76 @@ CCControl * CCControlButtonLoader::createCCNode(CCNode * pParent, CCBReader * pC
|
|||
return CCControlButton::node();
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_ZOOMONTOUCHDOWN) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_ZOOMONTOUCHDOWN) == 0) {
|
||||
((CCControlButton *)pNode)->setZoomOnTouchDown(pCheck);
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pString, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TITLE_NORMAL) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TITLE_NORMAL) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleForState(new CCString(pString), CCControlStateNormal); // TODO Leak?
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLE_HIGHLIGHTED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLE_HIGHLIGHTED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleForState(new CCString(pString), CCControlStateHighlighted); // TODO Leak?
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLE_DISABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLE_DISABLED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleForState(new CCString(pString), CCControlStateDisabled); // TODO Leak?
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypeString(pNode, pParent, pPropertyName, pString, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pFontTTF, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TITLETTF_NORMAL) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF.c_str(), CCControlStateNormal);
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF.c_str(), CCControlStateHighlighted);
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLETTF_DISABLED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF.c_str(), CCControlStateDisabled);
|
||||
void CCControlButtonLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TITLETTF_NORMAL) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateNormal);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateHighlighted);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_DISABLED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateDisabled);
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateNormal);
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateHighlighted);
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateDisabled);
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_LABELANCHORPOINT) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_LABELANCHORPOINT) == 0) {
|
||||
((CCControlButton *)pNode)->setLabelAnchorPoint(pPoint);
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_PREFEREDSIZE) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
|
||||
((CCControlButton *)pNode)->setPreferredSize(pSize);
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
|
||||
if(pCCSpriteFrame != NULL) {
|
||||
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateNormal);
|
||||
}
|
||||
} else if(pPropertyName.compare(PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
|
||||
if(pCCSpriteFrame != NULL) {
|
||||
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateHighlighted);
|
||||
}
|
||||
} else if(pPropertyName.compare(PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
|
||||
if(pCCSpriteFrame != NULL) {
|
||||
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateDisabled);
|
||||
}
|
||||
|
@ -104,12 +104,12 @@ void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode *
|
|||
}
|
||||
}
|
||||
|
||||
void CCControlButtonLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TITLECOLOR_NORMAL) == 0) {
|
||||
void CCControlButtonLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_NORMAL) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateNormal);
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateHighlighted);
|
||||
} else if(pPropertyName.compare(PROPERTY_TITLECOLOR_DISABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_DISABLED) == 0) {
|
||||
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateDisabled);
|
||||
} else {
|
||||
CCControlLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
|
|
|
@ -12,14 +12,14 @@ class CCControlButtonLoader : public CCControlLoader {
|
|||
protected:
|
||||
virtual CCControl * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeCheck(CCNode *, CCNode *, std::string, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeString(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeFontTTF(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatScale(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode *, CCNode *, std::string, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode *, CCNode *, std::string, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode *, CCNode *, std::string, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -7,18 +7,18 @@ using namespace cocos2d::extension;
|
|||
#define PROPERTY_SELECTED "selected"
|
||||
#define PROPERTY_CCCONTROL "ccControl"
|
||||
|
||||
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_ENABLED) == 0) {
|
||||
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
|
||||
((CCControl *)pNode)->setIsEnabled(pCheck);
|
||||
} else if(pPropertyName.compare(PROPERTY_SELECTED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
|
||||
((CCControl *)pNode)->setIsSelected(pCheck);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, std::string pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_CCCONTROL) == 0) {
|
||||
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
|
||||
// TODO selector thingy...
|
||||
((CCControl *)pNode)->addTargetWithActionForControlEvents(pBlockCCControlData->mTarget, pBlockCCControlData->mSELMenuHandler, pBlockCCControlData->mControlEvents); // TODO First paramater is wrong!
|
||||
} else {
|
||||
|
|
|
@ -12,8 +12,8 @@ class CCControlLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCControl * createCCNode(CCNode *, CCBReader *) = 0;
|
||||
|
||||
virtual void onHandlePropTypeBlockCCControl(CCNode *, CCNode *, std::string, BlockCCControlData *, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode *, CCNode *, std::string, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData *, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -13,41 +13,41 @@ CCLabelBMFont * CCLabelBMFontLoader::createCCNode(CCNode * pParent, CCBReader *
|
|||
return CCLabelBMFont::node();
|
||||
}
|
||||
|
||||
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_COLOR) == 0) {
|
||||
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setColor(pCCColor3B);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_OPACITY) == 0) {
|
||||
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pFntFile, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_FNTFILE) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setFntFile(pFntFile.c_str());
|
||||
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFntFile, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setFntFile(pFntFile);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pText, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_STRING) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setString(pText.c_str());
|
||||
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
|
||||
((CCLabelBMFont *)pNode)->setString(pText);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ class CCLabelBMFontLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCLabelBMFont * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeFntFile(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeText(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -17,58 +17,58 @@ CCLabelTTF * CCLabelTTFLoader::createCCNode(CCNode * pParent, CCBReader * pCCBRe
|
|||
return CCLabelTTF::node();
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_COLOR) == 0) {
|
||||
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((CCLabelTTF *)pNode)->setColor(pCCColor3B);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_OPACITY) == 0) {
|
||||
void CCLabelTTFLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((CCLabelTTF *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCLabelTTFLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((CCLabelTTF *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pFontTTF, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_FONTNAME) == 0) {
|
||||
((CCLabelTTF *)pNode)->setFontName(pFontTTF.c_str());
|
||||
void CCLabelTTFLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) {
|
||||
((CCLabelTTF *)pNode)->setFontName(pFontTTF);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pText, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_STRING) == 0) {
|
||||
((CCLabelTTF *)pNode)->setString(pText.c_str());
|
||||
void CCLabelTTFLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
|
||||
((CCLabelTTF *)pNode)->setString(pText);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_FONTSIZE) == 0) {
|
||||
void CCLabelTTFLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_FONTSIZE) == 0) {
|
||||
((CCLabelTTF *)pNode)->setFontSize(pFloatScale);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, std::string pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_HORIZONTALALIGNMENT) == 0) {
|
||||
void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_HORIZONTALALIGNMENT) == 0) {
|
||||
((CCLabelTTF *)pNode)->setHorizontalAlignment(CCTextAlignment(pIntegerLabeled));
|
||||
} else if(pPropertyName.compare(PROPERTY_VERTICALALIGNMENT) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_VERTICALALIGNMENT) == 0) {
|
||||
// TODO Add support when CCLabelTTF supports it. ( See: 63d9724ac4d81a05c6ec7feea0c01bcd27c8fc6b )
|
||||
// ((CCLabelTTF *)pNode)->setVerticalAlignment(pIntegerLabeled);
|
||||
} else {
|
||||
|
@ -76,8 +76,8 @@ void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * p
|
|||
}
|
||||
}
|
||||
|
||||
void CCLabelTTFLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_DIMENSIONS) == 0) {
|
||||
void CCLabelTTFLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_DIMENSIONS) == 0) {
|
||||
((CCLabelTTF *)pNode)->setDimensions(pSize);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
|
||||
|
|
|
@ -12,14 +12,14 @@ class CCLabelTTFLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCLabelTTF * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeFontTTF(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeText(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatScale(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypeIntegerLabeled(CCNode *, CCNode *, std::string, int, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode *, CCNode *, std::string, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
|
||||
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -11,24 +11,24 @@ CCLayerColor * CCLayerColorLoader::createCCNode(CCNode * pParent, CCBReader * pC
|
|||
return CCLayerColor::node();
|
||||
}
|
||||
|
||||
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_COLOR) == 0) {
|
||||
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((CCLayerColor *)pNode)->setColor(pCCColor3B);
|
||||
} else {
|
||||
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_OPACITY) == 0) {
|
||||
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((CCLayerColor *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((CCLayerColor *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
||||
|
|
|
@ -12,9 +12,9 @@ class CCLayerColorLoader : public CCLayerLoader {
|
|||
protected:
|
||||
virtual CCLayerColor * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -14,28 +14,28 @@ CCLayerGradient * CCLayerGradientLoader::createCCNode(CCNode * pParent, CCBReade
|
|||
return CCLayerGradient::node();
|
||||
}
|
||||
|
||||
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_STARTCOLOR) == 0) {
|
||||
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
|
||||
((CCLayerGradient *)pNode)->setStartColor(pCCColor3B);
|
||||
} else if(pPropertyName.compare(PROPERTY_ENDCOLOR) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
|
||||
((CCLayerGradient *)pNode)->setEndColor(pCCColor3B);
|
||||
} else {
|
||||
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_STARTOPACITY) == 0) {
|
||||
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_STARTOPACITY) == 0) {
|
||||
((CCLayerGradient *)pNode)->setStartOpacity(pByte);
|
||||
} else if(pPropertyName.compare(PROPERTY_ENDOPACITY) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ENDOPACITY) == 0) {
|
||||
((CCLayerGradient *)pNode)->setEndOpacity(pByte);
|
||||
} else {
|
||||
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((CCLayerGradient *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
||||
|
@ -43,8 +43,8 @@ void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * p
|
|||
}
|
||||
|
||||
|
||||
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_VECTOR) == 0) {
|
||||
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_VECTOR) == 0) {
|
||||
((CCLayerGradient *)pNode)->setVector(pPoint);
|
||||
|
||||
// TODO Not passed along the ccbi file.
|
||||
|
|
|
@ -12,10 +12,10 @@ class CCLayerGradientLoader : public CCLayerLoader {
|
|||
protected:
|
||||
virtual CCLayerGradient * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode *, CCNode *, std::string, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -12,15 +12,15 @@ CCLayer * CCLayerLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader)
|
|||
return CCLayer::node();
|
||||
}
|
||||
|
||||
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TOUCH_ENABLED) == 0) {
|
||||
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
|
||||
((CCLayer *)pNode)->setIsTouchEnabled(pCheck);
|
||||
} else if(pPropertyName.compare(PROPERTY_ACCELEROMETER_ENABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
|
||||
((CCLayer *)pNode)->setIsAccelerometerEnabled(pCheck);
|
||||
} else if(pPropertyName.compare(PROPERTY_MOUSE_ENABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
|
||||
// TODO XXX
|
||||
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);
|
||||
} else if(pPropertyName.compare(PROPERTY_KEYBOARD_ENABLED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_KEYBOARD_ENABLED) == 0) {
|
||||
// TODO XXX
|
||||
CCLOG("The property '%s' is not supported!", PROPERTY_KEYBOARD_ENABLED);
|
||||
// This comes closest: ((CCLayer *)pNode)->setIsKeypadEnabled(pCheck);
|
||||
|
|
|
@ -12,7 +12,7 @@ class CCLayerLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCLayer * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeCheck(CCNode *, CCNode *, std::string, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -11,12 +11,12 @@ CCMenuItemImage * CCMenuItemImageLoader::createCCNode(CCNode * pParent, CCBReade
|
|||
return CCMenuItemImage::node();
|
||||
}
|
||||
|
||||
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_NORMALDISPLAYFRAME) == 0) {
|
||||
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
|
||||
((CCMenuItemImage *)pNode)->setNormalSpriteFrame(pCCSpriteFrame);
|
||||
} else if(pPropertyName.compare(PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
|
||||
((CCMenuItemImage *)pNode)->setSelectedSpriteFrame(pCCSpriteFrame);
|
||||
} else if(pPropertyName.compare(PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
|
||||
((CCMenuItemImage *)pNode)->setDisabledSpriteFrame(pCCSpriteFrame);
|
||||
} else {
|
||||
CCMenuItemLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
|
||||
|
|
|
@ -12,7 +12,7 @@ class CCMenuItemImageLoader : public CCMenuItemLoader {
|
|||
protected:
|
||||
virtual CCMenuItemImage * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode *, CCNode *, std::string, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -6,16 +6,16 @@ using namespace cocos2d::extension;
|
|||
#define PROPERTY_BLOCK "block"
|
||||
#define PROPERTY_ISENABLED "isEnabled"
|
||||
|
||||
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, std::string pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLOCK) == 0) {
|
||||
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
|
||||
((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_ISENABLED) == 0) {
|
||||
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
|
||||
((CCMenuItem *)pNode)->setIsEnabled(pCheck);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
||||
|
|
|
@ -12,8 +12,8 @@ class CCMenuItemLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCMenuItem * createCCNode(CCNode *, CCBReader *) = 0;
|
||||
|
||||
virtual void onHandlePropTypeBlock(CCNode *, CCNode *, std::string, BlockData *, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode *, CCNode *, std::string, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData *, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
|
||||
#define PROPERTY_VISIBLE "visible"
|
||||
|
||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) printf("Unexpected property: '%s'!\n", PROPERTY.c_str()); assert(false)
|
||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) printf("Unexpected property: '%s'!\n", PROPERTY); assert(false)
|
||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) printf("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
|
||||
|
||||
using namespace cocos2d;
|
||||
|
@ -31,7 +31,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
|||
int propertyCount = pCCBReader->readInt(false);
|
||||
for(int i = 0; i < propertyCount; i++) {
|
||||
int type = pCCBReader->readInt(false);
|
||||
std::string propertyName = pCCBReader->readCachedString();
|
||||
const char * propertyName = pCCBReader->readCachedString();
|
||||
|
||||
// Check if the property can be set for this platform
|
||||
bool setProp = false;
|
||||
|
@ -199,28 +199,28 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
|||
break;
|
||||
}
|
||||
case kCCBPropTypeFntFile: {
|
||||
std::string fntFile = this->parsePropTypeFntFile(pNode, pParent, pCCBReader);
|
||||
const char * fntFile = this->parsePropTypeFntFile(pNode, pParent, pCCBReader);
|
||||
if(setProp) {
|
||||
this->onHandlePropTypeFntFile(pNode, pParent, propertyName, fntFile, pCCBReader);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kCCBPropTypeFontTTF: {
|
||||
std::string fontTTF = this->parsePropTypeFontTTF(pNode, pParent, pCCBReader);
|
||||
const char * fontTTF = this->parsePropTypeFontTTF(pNode, pParent, pCCBReader);
|
||||
if(setProp) {
|
||||
this->onHandlePropTypeFontTTF(pNode, pParent, propertyName, fontTTF, pCCBReader);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kCCBPropTypeString: {
|
||||
std::string string = this->parsePropTypeString(pNode, pParent, pCCBReader);
|
||||
const char * string = this->parsePropTypeString(pNode, pParent, pCCBReader);
|
||||
if(setProp) {
|
||||
this->onHandlePropTypeString(pNode, pParent, propertyName, string, pCCBReader);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kCCBPropTypeText: {
|
||||
std::string text = this->parsePropTypeText(pNode, pParent, pCCBReader);
|
||||
const char * text = this->parsePropTypeText(pNode, pParent, pCCBReader);
|
||||
if(setProp) {
|
||||
this->onHandlePropTypeText(pNode, pParent, propertyName, text, pCCBReader);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ float * CCNodeLoader::parsePropTypeScaleLock(CCNode * pNode, CCNode * pParent, C
|
|||
|
||||
int type = pCCBReader->readInt(false);
|
||||
|
||||
if (type == kCCBScaleTypeMultiplyResolution) {
|
||||
if(type == kCCBScaleTypeMultiplyResolution) {
|
||||
x *= pCCBReader->getResolutionScale();
|
||||
y *= pCCBReader->getResolutionScale();
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ float CCNodeLoader::parsePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CC
|
|||
|
||||
int type = pCCBReader->readInt(false);
|
||||
|
||||
if (type == kCCBScaleTypeMultiplyResolution) {
|
||||
if(type == kCCBScaleTypeMultiplyResolution) {
|
||||
f *= pCCBReader->getResolutionScale();
|
||||
}
|
||||
|
||||
|
@ -407,34 +407,34 @@ bool CCNodeLoader::parsePropTypeCheck(CCNode * pNode, CCNode * pParent, CCBReade
|
|||
|
||||
|
||||
CCSpriteFrame * CCNodeLoader::parsePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string spriteSheet = pCCBReader->readCachedString();
|
||||
std::string spriteFile = pCCBReader->readCachedString();
|
||||
const char * spriteSheet = pCCBReader->readCachedString();
|
||||
const char * spriteFile = pCCBReader->readCachedString();
|
||||
|
||||
CCSpriteFrame * spriteFrame;
|
||||
if (spriteSheet.compare("") == 0) {
|
||||
if (spriteFile.compare("") == 0) {
|
||||
if(strcmp(spriteSheet, "") == 0) {
|
||||
if(strcmp(spriteFile, "") == 0) {
|
||||
return NULL;
|
||||
}
|
||||
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFile.c_str());
|
||||
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFile);
|
||||
CCRect bounds = CCRect::CCRect(0, 0, texture->getContentSize().width, texture->getContentSize().height);
|
||||
spriteFrame = CCSpriteFrame::frameWithTexture(texture, bounds);
|
||||
} else {
|
||||
CCSpriteFrameCache * frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
|
||||
|
||||
/* Load the sprite sheet only if it is not loaded. */
|
||||
if (!pCCBReader->isSpriteSheetLoaded(spriteSheet)) {
|
||||
frameCache->addSpriteFramesWithFile(spriteSheet.c_str());
|
||||
if(!pCCBReader->isSpriteSheetLoaded(spriteSheet)) {
|
||||
frameCache->addSpriteFramesWithFile(spriteSheet);
|
||||
pCCBReader->addLoadedSpriteSheet(spriteSheet);
|
||||
}
|
||||
|
||||
spriteFrame = frameCache->spriteFrameByName(spriteFile.c_str());
|
||||
spriteFrame = frameCache->spriteFrameByName(spriteFile);
|
||||
}
|
||||
return spriteFrame;
|
||||
}
|
||||
|
||||
CCAnimation * CCNodeLoader::parsePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string animationFile = pCCBReader->readCachedString();
|
||||
std::string animation = pCCBReader->readCachedString();
|
||||
const char * animationFile = pCCBReader->readCachedString();
|
||||
const char * animation = pCCBReader->readCachedString();
|
||||
|
||||
CCAnimation * ccAnimation = NULL;
|
||||
|
||||
|
@ -446,19 +446,19 @@ CCAnimation * CCNodeLoader::parsePropTypeAnimation(CCNode * pNode, CCNode * pPar
|
|||
animation = pCCBReader->lastPathComponent(animation);
|
||||
animationFile = pCCBReader->lastPathComponent(animationFile);
|
||||
|
||||
if (animation.compare("") != 0) {
|
||||
if(strcmp(animation, "") != 0) {
|
||||
CCAnimationCache * animationCache = CCAnimationCache::sharedAnimationCache();
|
||||
animationCache->addAnimationsWithFile(animationFile.c_str());
|
||||
animationCache->addAnimationsWithFile(animationFile);
|
||||
|
||||
ccAnimation = animationCache->animationByName(animation.c_str());
|
||||
ccAnimation = animationCache->animationByName(animation);
|
||||
}
|
||||
return ccAnimation;
|
||||
}
|
||||
|
||||
CCTexture2D * CCNodeLoader::parsePropTypeTexture(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string spriteFile = pCCBReader->readCachedString();
|
||||
const char * spriteFile = pCCBReader->readCachedString();
|
||||
|
||||
return CCTextureCache::sharedTextureCache()->addImage(spriteFile.c_str());
|
||||
return CCTextureCache::sharedTextureCache()->addImage(spriteFile);
|
||||
}
|
||||
|
||||
unsigned char CCNodeLoader::parsePropTypeByte(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
|
@ -520,24 +520,24 @@ ccBlendFunc CCNodeLoader::parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParen
|
|||
return blendFunc;
|
||||
}
|
||||
|
||||
std::string CCNodeLoader::parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
const char * CCNodeLoader::parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
return pCCBReader->readCachedString();
|
||||
}
|
||||
|
||||
std::string CCNodeLoader::parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
const char * CCNodeLoader::parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
return pCCBReader->readCachedString();
|
||||
}
|
||||
|
||||
std::string CCNodeLoader::parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
const char * CCNodeLoader::parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
return pCCBReader->readCachedString();
|
||||
}
|
||||
|
||||
std::string CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string fnt = pCCBReader->readCachedString();
|
||||
const char * CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
const char * fnt = pCCBReader->readCachedString();
|
||||
|
||||
std::string ttfEnding("ttf");
|
||||
const char * ttfEnding("ttf");
|
||||
|
||||
if (pCCBReader->endsWith(pCCBReader->toLowerCase(fnt), ttfEnding)){
|
||||
if(pCCBReader->endsWith(pCCBReader->toLowerCase(fnt), ttfEnding)){
|
||||
fnt = pCCBReader->deletePathExtension(pCCBReader->lastPathComponent(fnt));
|
||||
}
|
||||
|
||||
|
@ -545,19 +545,19 @@ std::string CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent,
|
|||
}
|
||||
|
||||
BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string selectorName = pCCBReader->readCachedString();
|
||||
const char * selectorName = pCCBReader->readCachedString();
|
||||
int selectorTarget = pCCBReader->readInt(false);
|
||||
|
||||
if(selectorTarget != kCCBTargetTypeNone) {
|
||||
CCObject * target = NULL;
|
||||
if(selectorTarget == kCCBTargetTypeDocumentRoot) {
|
||||
target = pCCBReader->getRootNode();
|
||||
} else if (selectorTarget == kCCBTargetTypeOwner) {
|
||||
} else if(selectorTarget == kCCBTargetTypeOwner) {
|
||||
target = pCCBReader->getOwner();
|
||||
}
|
||||
|
||||
if(target != NULL) {
|
||||
if(selectorName.length() > 0) {
|
||||
if(strlen(selectorName) > 0) {
|
||||
CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver();
|
||||
if(ccbSelectorResolver != NULL) {
|
||||
BlockData * blockData = new BlockData();
|
||||
|
@ -567,7 +567,7 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
|
|||
|
||||
return blockData;
|
||||
} else {
|
||||
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName.c_str());
|
||||
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName);
|
||||
}
|
||||
} else {
|
||||
CCLOG("Unexpected empty selector.");
|
||||
|
@ -581,7 +581,7 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
|
|||
}
|
||||
|
||||
BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string selectorName = pCCBReader->readCachedString();
|
||||
const char * selectorName = pCCBReader->readCachedString();
|
||||
int selectorTarget = pCCBReader->readInt(false);
|
||||
int controlEvents = pCCBReader->readInt(false);
|
||||
|
||||
|
@ -589,12 +589,12 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
|
|||
CCObject * target = NULL;
|
||||
if(selectorTarget == kCCBTargetTypeDocumentRoot) {
|
||||
target = pCCBReader->getRootNode();
|
||||
} else if (selectorTarget == kCCBTargetTypeOwner) {
|
||||
} else if(selectorTarget == kCCBTargetTypeOwner) {
|
||||
target = pCCBReader->getOwner();
|
||||
}
|
||||
|
||||
if(target != NULL) {
|
||||
if(selectorName.length() > 0) {
|
||||
if(strlen(selectorName) > 0) {
|
||||
CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver();
|
||||
if(ccbSelectorResolver != NULL) {
|
||||
BlockCCControlData * blockCCControlData = new BlockCCControlData();
|
||||
|
@ -605,7 +605,7 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
|
|||
|
||||
return blockCCControlData;
|
||||
} else {
|
||||
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName.c_str());
|
||||
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName);
|
||||
}
|
||||
} else {
|
||||
CCLOG("Unexpected empty selector.");
|
||||
|
@ -619,14 +619,19 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
|
|||
}
|
||||
|
||||
CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||
std::string ccbFileName = pCCBReader->readCachedString();
|
||||
const char * ccbFileName = pCCBReader->readCachedString();
|
||||
|
||||
/* Change path extension to .ccbi. */
|
||||
std::string ccbiFileName = pCCBReader->deletePathExtension(ccbFileName) + std::string(".ccbi");
|
||||
const char * ccbFileWithoutPathExtension = pCCBReader->deletePathExtension(ccbFileName);
|
||||
int ccbiFileNameLenght = strlen(ccbFileWithoutPathExtension) + strlen(".ccbi");
|
||||
char * ccbiFileName = new char[ccbiFileNameLenght + 1]; // TODO Memory leak?
|
||||
strcpy(ccbiFileName, ccbFileWithoutPathExtension);
|
||||
strcat(ccbiFileName, ".ccbi");
|
||||
ccbiFileName[ccbiFileNameLenght] = '\0';
|
||||
|
||||
CCBReader * ccbReader = new CCBReader(pCCBReader);
|
||||
|
||||
CCNode * ccbFileNode = ccbReader->readNodeGraphFromFile(ccbiFileName.c_str(), pCCBReader->getOwner(), pParent->getContentSize());
|
||||
CCNode * ccbFileNode = ccbReader->readNodeGraphFromFile(ccbiFileName, pCCBReader->getOwner(), pParent->getContentSize());
|
||||
|
||||
delete ccbReader;
|
||||
|
||||
|
@ -635,36 +640,36 @@ CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CC
|
|||
|
||||
|
||||
|
||||
void CCNodeLoader::onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCPoint pPosition, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_POSITION) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_POSITION) == 0) {
|
||||
pNode->setPosition(pPosition);
|
||||
} else {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_ANCHORPOINT) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_ANCHORPOINT) == 0) {
|
||||
pNode->setAnchorPoint(pPoint);
|
||||
} else {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_CONTENTSIZE) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
|
||||
pNode->setContentSize(pSize);
|
||||
} else {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float * pScaleLock, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_SCALE) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pScaleLock, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
|
||||
pNode->setScaleX(pScaleLock[0]);
|
||||
pNode->setScaleY(pScaleLock[1]);
|
||||
} else {
|
||||
|
@ -672,104 +677,104 @@ void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, s
|
|||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pDegrees, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_ROTATION) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pDegrees, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_ROTATION) == 0) {
|
||||
pNode->setRotation(pDegrees);
|
||||
} else {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, std::string pPropertyName, int pInteger, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TAG) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TAG) == 0) {
|
||||
pNode->setTag(pInteger);
|
||||
} else {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, std::string pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_VISIBLE) == 0) {
|
||||
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_VISIBLE) == 0) {
|
||||
pNode->setIsVisible(pCheck);
|
||||
} else if(pPropertyName.compare(PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
|
||||
pNode->setIsRelativeAnchorPoint(!pCheck);
|
||||
} else {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pFntFile, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFntFile, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pString, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pText, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, std::string pPropertyName, std::string pFontTTF, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, std::string pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, std::string pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
||||
|
||||
void CCNodeLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
||||
void CCNodeLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
||||
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
|
||||
}
|
|
@ -48,42 +48,42 @@ class CC_DLL CCNodeLoader {
|
|||
virtual ccColor4F * parsePropTypeColor4FVar(CCNode *, CCNode *, CCBReader *);
|
||||
virtual bool * parsePropTypeFlip(CCNode *, CCNode *, CCBReader *);
|
||||
virtual ccBlendFunc parsePropTypeBlendFunc(CCNode *, CCNode *, CCBReader *);
|
||||
virtual std::string parsePropTypeFntFile(CCNode *, CCNode *, CCBReader *);
|
||||
virtual std::string parsePropTypeString(CCNode *, CCNode *, CCBReader *);
|
||||
virtual std::string parsePropTypeText(CCNode *, CCNode *, CCBReader *);
|
||||
virtual std::string parsePropTypeFontTTF(CCNode *, CCNode *, CCBReader *);
|
||||
virtual const char * parsePropTypeFntFile(CCNode *, CCNode *, CCBReader *);
|
||||
virtual const char * parsePropTypeString(CCNode *, CCNode *, CCBReader *);
|
||||
virtual const char * parsePropTypeText(CCNode *, CCNode *, CCBReader *);
|
||||
virtual const char * parsePropTypeFontTTF(CCNode *, CCNode *, CCBReader *);
|
||||
virtual BlockData * parsePropTypeBlock(CCNode *, CCNode *, CCBReader *);
|
||||
virtual BlockCCControlData * parsePropTypeBlockCCControl(CCNode *, CCNode *, CCBReader *);
|
||||
virtual CCNode * parsePropTypeCCBFile(CCNode *, CCNode *, CCBReader *);
|
||||
|
||||
|
||||
virtual void onHandlePropTypePosition(CCNode *, CCNode *, std::string, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode *, CCNode *, std::string, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypePointLock(CCNode *, CCNode *, std::string, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode *, CCNode *, std::string, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeScaleLock(CCNode *, CCNode *, std::string, float *, CCBReader *);
|
||||
virtual void onHandlePropTypeFloat(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypeDegrees(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatScale(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypeInteger(CCNode *, CCNode *, std::string, int, CCBReader *);
|
||||
virtual void onHandlePropTypeIntegerLabeled(CCNode *, CCNode *, std::string, int, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatVar(CCNode *, CCNode *, std::string, float *, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode *, CCNode *, std::string, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode *, CCNode *, std::string, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeAnimation(CCNode *, CCNode *, std::string, CCAnimation *, CCBReader *);
|
||||
virtual void onHandlePropTypeTexture(CCNode *, CCNode *, std::string, CCTexture2D *, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeColor4FVar(CCNode *, CCNode *, std::string, ccColor4F *, CCBReader *);
|
||||
virtual void onHandlePropTypeFlip(CCNode *, CCNode *, std::string, bool *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeFntFile(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeString(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeText(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeFontTTF(CCNode *, CCNode *, std::string, std::string, CCBReader *);
|
||||
virtual void onHandlePropTypeBlock(CCNode *, CCNode *, std::string, BlockData *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlockCCControl(CCNode *, CCNode *, std::string, BlockCCControlData *, CCBReader *);
|
||||
virtual void onHandlePropTypeCCBFile(CCNode *, CCNode *, std::string, CCNode *, CCBReader *);
|
||||
virtual void onHandlePropTypePosition(CCNode *, CCNode *, const char *, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode *, CCNode *, const char *, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypePointLock(CCNode *, CCNode *, const char *, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode *, CCNode *, const char *, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeScaleLock(CCNode *, CCNode *, const char *, float *, CCBReader *);
|
||||
virtual void onHandlePropTypeFloat(CCNode *, CCNode *, const char *, float, CCBReader *);
|
||||
virtual void onHandlePropTypeDegrees(CCNode *, CCNode *, const char *, float, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatScale(CCNode *, CCNode *, const char *, float, CCBReader *);
|
||||
virtual void onHandlePropTypeInteger(CCNode *, CCNode *, const char *, int, CCBReader *);
|
||||
virtual void onHandlePropTypeIntegerLabeled(CCNode *, CCNode *, const char *, int, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatVar(CCNode *, CCNode *, const char *, float *, CCBReader *);
|
||||
virtual void onHandlePropTypeCheck(CCNode *, CCNode *, const char *, bool, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode *, CCNode *, const char *, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeAnimation(CCNode *, CCNode *, const char *, CCAnimation *, CCBReader *);
|
||||
virtual void onHandlePropTypeTexture(CCNode *, CCNode *, const char *, CCTexture2D *, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, const char *, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, const char *, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeColor4FVar(CCNode *, CCNode *, const char *, ccColor4F *, CCBReader *);
|
||||
virtual void onHandlePropTypeFlip(CCNode *, CCNode *, const char *, bool *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, const char *, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeFntFile(CCNode *, CCNode *, const char *, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeString(CCNode *, CCNode *, const char *, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeText(CCNode *, CCNode *, const char *, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeFontTTF(CCNode *, CCNode *, const char *, const char *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlock(CCNode *, CCNode *, const char *, BlockData *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlockCCControl(CCNode *, CCNode *, const char *, BlockCCControlData *, CCBReader *);
|
||||
virtual void onHandlePropTypeCCBFile(CCNode *, CCNode *, const char *, CCNode *, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -30,77 +30,77 @@ CCParticleSystemQuad * CCParticleSystemQuadLoader::createCCNode(CCNode * pParent
|
|||
return CCParticleSystemQuad::node();
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, std::string pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_EMITERMODE) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_EMITERMODE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setEmitterMode(pIntegerLabeled);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeIntegerLabeled(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_POSVAR) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_POSVAR) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setPosVar(pPoint);
|
||||
} else if(pPropertyName.compare(PROPERTY_GRAVITY) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_GRAVITY) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setGravity(pPoint);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_EMISSIONRATE) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_EMISSIONRATE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setEmissionRate(pFloat);
|
||||
} else if(pPropertyName.compare(PROPERTY_DURATION) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_DURATION) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setDuration(pFloat);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, std::string pPropertyName, int pInteger, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TOTALPARTICLES) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TOTALPARTICLES) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setTotalParticles(pInteger);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeInteger(pNode, pParent, pPropertyName, pInteger, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_LIFE) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_LIFE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setLife(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setLifeVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_STARTSIZE) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_STARTSIZE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setStartSize(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setStartSizeVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_ENDSIZE) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ENDSIZE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setEndSize(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setEndSizeVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_STARTSPIN) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_STARTSPIN) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setStartSpin(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setStartSpinVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_ENDSPIN) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ENDSPIN) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setEndSpin(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setEndSpinVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_ANGLE) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ANGLE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setAngle(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setAngleVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_SPEED) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_SPEED) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setSpeed(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setSpeedVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_TANGENTIALACCEL) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_TANGENTIALACCEL) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setTangentialAccel(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setTangentialAccelVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_RADIALACCEL) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_RADIALACCEL) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setRadialAccel(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setRadialAccelVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_STARTRADIUS) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_STARTRADIUS) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setStartRadius(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setStartRadiusVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_ENDRADIUS) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ENDRADIUS) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setEndRadius(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setEndRadiusVar(pFloatVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_ROTATEPERSECOND) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ROTATEPERSECOND) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setRotatePerSecond(pFloatVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setRotatePerSecondVar(pFloatVar[1]);
|
||||
} else {
|
||||
|
@ -108,11 +108,11 @@ void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode
|
|||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_STARTCOLOR) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setStartColor(pCCColor4FVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setStartColorVar(pCCColor4FVar[1]);
|
||||
} else if(pPropertyName.compare(PROPERTY_ENDCOLOR) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setEndColor(pCCColor4FVar[0]);
|
||||
((CCParticleSystemQuad *)pNode)->setEndColorVar(pCCColor4FVar[1]);
|
||||
} else {
|
||||
|
@ -120,16 +120,16 @@ void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNo
|
|||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_TEXTURE) == 0) {
|
||||
void CCParticleSystemQuadLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) {
|
||||
((CCParticleSystemQuad *)pNode)->setTexture(pCCTexture2D);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pCCTexture2D, pCCBReader);
|
||||
|
|
|
@ -12,14 +12,14 @@ class CCParticleSystemQuadLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCParticleSystemQuad * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeIntegerLabeled(CCNode *, CCNode *, std::string, int, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode *, CCNode *, std::string, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeFloat(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypeInteger(CCNode *, CCNode *, std::string, int, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatVar(CCNode *, CCNode *, std::string, float *, CCBReader *);
|
||||
virtual void onHandlePropTypeColor4FVar(CCNode *, CCNode *, std::string, ccColor4F *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeTexture(CCNode *, CCNode *, std::string, CCTexture2D *, CCBReader *);
|
||||
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int, CCBReader *);
|
||||
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint, CCBReader *);
|
||||
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
|
||||
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int, CCBReader *);
|
||||
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float *, CCBReader *);
|
||||
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F *, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D *, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -18,32 +18,32 @@ CCScale9Sprite * CCScale9SpriteLoader::createCCNode(CCNode * pParent, CCBReader
|
|||
return CCScale9Sprite::node();
|
||||
}
|
||||
|
||||
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_SPRITEFRAME) == 0) {
|
||||
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_SPRITEFRAME) == 0) {
|
||||
((CCScale9Sprite *)pNode)->initWithSpriteFrame(pCCSpriteFrame);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCScale9SpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_COLOR) == 0) {
|
||||
void CCScale9SpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setColor(pCCColor3B);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCScale9SpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_OPACITY) == 0) {
|
||||
void CCScale9SpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
// TODO Not exported by CocosBuilder yet!
|
||||
// ((CCScale9Sprite *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
|
@ -51,24 +51,24 @@ void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pP
|
|||
}
|
||||
}
|
||||
|
||||
void CCScale9SpriteLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_CONTENTSIZE) == 0) {
|
||||
void CCScale9SpriteLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
|
||||
//((CCScale9Sprite *)pNode)->setContentSize(pSize);
|
||||
} else if(pPropertyName.compare(PROPERTY_PREFEREDSIZE) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setPreferredSize(pSize);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCScale9SpriteLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, std::string pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_INSETLEFT) == 0) {
|
||||
void CCScale9SpriteLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_INSETLEFT) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setInsetLeft(pFloat);
|
||||
} else if(pPropertyName.compare(PROPERTY_INSETTOP) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_INSETTOP) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setInsetTop(pFloat);
|
||||
} else if(pPropertyName.compare(PROPERTY_INSETRIGHT) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_INSETRIGHT) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setInsetRight(pFloat);
|
||||
} else if(pPropertyName.compare(PROPERTY_INSETBOTTOM) == 0) {
|
||||
} else if(strcmp(pPropertyName, PROPERTY_INSETBOTTOM) == 0) {
|
||||
((CCScale9Sprite *)pNode)->setInsetBottom(pFloat);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
||||
|
|
|
@ -12,12 +12,12 @@ class CCScale9SpriteLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCScale9Sprite * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode *, CCNode *, std::string, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode *, CCNode *, std::string, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeFloat(CCNode *, CCNode *, std::string, float, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize, CCBReader *);
|
||||
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -13,16 +13,16 @@ CCSprite * CCSpriteLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader
|
|||
return CCSprite::node();
|
||||
}
|
||||
|
||||
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, std::string pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_DISPLAYFRAME) == 0) {
|
||||
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) {
|
||||
((CCSprite *)pNode)->setDisplayFrame(pCCSpriteFrame);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, std::string pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_FLIP) == 0) {
|
||||
void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_FLIP) == 0) {
|
||||
((CCSprite *)pNode)->setFlipX(pFlip[0]);
|
||||
((CCSprite *)pNode)->setFlipX(pFlip[1]);
|
||||
} else {
|
||||
|
@ -30,24 +30,24 @@ void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, std:
|
|||
}
|
||||
}
|
||||
|
||||
void CCSpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_COLOR) == 0) {
|
||||
void CCSpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((CCSprite *)pNode)->setColor(pCCColor3B);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, std::string pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_OPACITY) == 0) {
|
||||
void CCSpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((CCSprite *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(pPropertyName.compare(PROPERTY_BLENDFUNC) == 0) {
|
||||
void CCSpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((CCSprite *)pNode)->setBlendFunc(pCCBlendFunc);
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
||||
|
|
|
@ -12,11 +12,11 @@ class CCSpriteLoader : public CCNodeLoader {
|
|||
protected:
|
||||
virtual CCSprite * createCCNode(CCNode *, CCBReader *);
|
||||
|
||||
virtual void onHandlePropTypeColor3(CCNode *, CCNode *, std::string, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode *, CCNode *, std::string, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode *, CCNode *, std::string, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode *, CCNode *, std::string, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeFlip(CCNode *, CCNode *, std::string, bool *, CCBReader *);
|
||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
|
||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
|
||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
|
||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
|
||||
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool *, CCBReader *);
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
Loading…
Reference in New Issue