CLabelAtlas* CLabelAtlas::create(const char* pString, const char* fntFile) { CLabelAtlas *pRet = new CLabelAtlas(); if( pRet && pRet->initWithString(pString, fntFile) ) { pRet->setTouchEnabled(false); pRet->setAnchorPoint(CCWIDGET_BASIC_DEFAULT_ANCHOR_POINT); pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return pRet; }
CLabelAtlas* CLabelAtlas::create(const char* pString, const char* charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap) { CLabelAtlas *pRet = new CLabelAtlas(); if( pRet && pRet->initWithString(pString, charMapFile, itemWidth, itemHeight, startCharMap) ) { pRet->setTouchEnabled(false); pRet->setAnchorPoint(CCWIDGET_BASIC_DEFAULT_ANCHOR_POINT); pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
bool CLabelAtlasTest::init() { CLabelTestSceneBase::init(); setTitle("CLabelBasicTest"); setDescription("CLabelAtlas extern CCLabelAtlas (test event)"); CLabelAtlas* pText = CLabelAtlas::create(":;0123456789", "num.png", 26, 34, 48); pText->setTouchEnabled(true); pText->setAnchorPoint(Vec2(0.5, 0.5)); pText->setPosition(Vec2(480, 320)); pText->setOnTouchBeganListener(this, ccw_touchbegan_selector(CLabelAtlasTest::onTouchBegan)); pText->setOnTouchEndedListener(this, ccw_touchevent_selector(CLabelAtlasTest::onTouchEnded)); pText->setOnTouchCancelledListener(this, ccw_touchevent_selector(CLabelAtlasTest::onTouchEnded)); m_pWindow->addChild(pText); return true; }