CCLabelTTF * CCLabelTTF::labelWithString(const char *label, const char *fontName, float fontSize) { CCLabelTTF *pRet = new CCLabelTTF(); if(pRet && pRet->initWithString(label, fontName, fontSize)) { pRet->autorelease(); return pRet; } CCX_SAFE_DELETE(pRet) return NULL; }
CCLabelTTF* CCLabelTTF::create(const char *string, const cocos2d::CCSize &dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize) { CCLabelTTF *pRet = new CCLabelTTF(); if(pRet && pRet->initWithString(string, dimensions, hAlignment, vAlignment, fontName, fontSize)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CCLabelTTF * CCLabelTTF::createWithFontDefinition(const char *string, ccFontDefinition &textDefinition) { CCLabelTTF *pRet = new CCLabelTTF(); if(pRet && pRet->initWithStringAndTextDefinition(string, textDefinition)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CCLabelTTF * CCLabelTTF::labelWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) { CCLabelTTF *pRet = new CCLabelTTF(); if(pRet && pRet->initWithString(label, dimensions, alignment, fontName, fontSize)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CCLabelTTF * CCLabelTTF::create() { CCLabelTTF * pRet = new CCLabelTTF(); if (pRet && pRet->init()) { pRet->autorelease(); } else { CC_SAFE_DELETE(pRet); } return pRet; }
TTFFontInit::TTFFontInit() { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* font = new CCLabelTTF(); font->init(); font->autorelease(); font->setFontName("Marker Felt"); font->setFontSize(48); font->setString("It is working!"); this->addChild(font); font->setPosition(ccp(s.width/2,s.height/4*2)); }