Fixed CCLabelBMFontLoader (according to changes in: 827ee160b5).

This commit is contained in:
Nicolas Gramlich 2012-05-30 15:37:36 -07:00
parent c754dac31b
commit 5578521a69
2 changed files with 21 additions and 6 deletions

View File

@ -6,14 +6,11 @@ using namespace cocos2d::extension;
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
#define PROPERTY_FNTFILE "fntFile"
#define PROPERTY_STRING "string"
CCLabelBMFont * CCLabelBMFontLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
if(pRet && pRet->initWithString(str, fntFile)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return new CCLabelBMFont(); // TODO Is this problematic?
return CCLabelBMFont::node();
}
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, std::string pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
@ -38,4 +35,20 @@ void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pPa
} 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());
} 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());
} else {
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
}
}

View File

@ -15,6 +15,8 @@ class CCLabelBMFontLoader : public CCNodeLoader {
virtual void onHandlePropTypeColor3(cocos2d::CCNode *, cocos2d::CCNode *, std::string, cocos2d::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 *);
};
NS_CC_EXT_END