bool MenuItemAtlasFont::initWithString(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, const ccMenuCallback& callback) { CCASSERT( value.size() != 0, "value length must be greater than 0"); LabelAtlas *label = LabelAtlas::create(); label->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap); if (MenuItemLabel::initWithLabel(label, callback)) { // do something ? } return true; }
LabelAtlas* LabelAtlas::create(const std::string& string, const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) { LabelAtlas* ret = new LabelAtlas(); if(ret && ret->initWithString(string, charMapFile, itemWidth, itemHeight, startCharMap)) { ret->autorelease(); return ret; } CC_SAFE_DELETE(ret); return nullptr; }
bool MenuItemAtlasFont::initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, const ccMenuCallback& callback) { CCAssert( value != NULL && strlen(value) != 0, "value length must be greater than 0"); LabelAtlas *label = new LabelAtlas(); label->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap); label->autorelease(); if (MenuItemLabel::initWithLabel(label, callback)) { // do something ? } return true; }
NS_CC_BEGIN //CCLabelAtlas - Creation & Init LabelAtlas* LabelAtlas::create(const std::string& string, const std::string& charMapFile, long itemWidth, long itemHeight, long startCharMap) { LabelAtlas *pRet = new LabelAtlas(); if(pRet && pRet->initWithString(string, charMapFile, itemWidth, itemHeight, startCharMap)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
LabelAtlas* LabelAtlas::create(const std::string& string, const std::string& fntFile) { LabelAtlas *ret = new LabelAtlas(); if (ret) { if (ret->initWithString(string, fntFile)) { ret->autorelease(); } else { CC_SAFE_RELEASE_NULL(ret); } } return ret; }