本文整理汇总了C++中CCLabelAtlas类的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelAtlas类的具体用法?C++ CCLabelAtlas怎么用?C++ CCLabelAtlas使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCLabelAtlas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setStageNum
void GameTipsSprite::setStageNum(int num){
CCLabelAtlas* stagenumbrer =(CCLabelAtlas*) this->getChildByTag(4);
char* temp=new char[12];
sprintf(temp,"%d",num);
stagenumbrer->setString(temp);
delete temp;
}
示例2: setMonstTotalNum
void GameTipsSprite::setMonstTotalNum(int num){
CCLabelAtlas* monsttotalnumbrer =(CCLabelAtlas*) this->getChildByTag(3);
char* temp=new char[12];
sprintf(temp,"%d",num);
monsttotalnumbrer->setString(temp);
delete temp;
}
示例3: ItemCard
ItemCard* ItemCard::spriteWithFile(const char *normalImage, string id, short cardNum)
{
ItemCard* pRet = new ItemCard(id, cardNum);
if ((normalImage == NULL) || (*normalImage == 0)) {
normalImage = "box_none.png";
}
if (pRet && pRet->initWithFile(normalImage))
{
pRet->autorelease();
char buf[30];
sprintf(buf, "/%d",cardNum);
CCSprite* spTmp = CCSprite::spriteWithFile("rewardnum.png");
if(spTmp){
CCSize sz = spTmp->getContentSize();
CCLabelAtlas* textNum = CCLabelAtlas::labelWithString(buf,
"rewardnum.png",
sz.width / 11,
sz.height,
'/');
textNum->setAnchorPoint(ccp(0.5, 0.5));
textNum->setPosition(ccp(54,10));
pRet->addChild(textNum,0,9);
}
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例4: addMapBtnWith
CCSprite* LevelScene::addMapBtnWith(int no, cocos2d::CCPoint pos, CCSpriteBatchNode* batch)
{
CCSprite *map = NULL;
CCSprite *lockSprite = NULL;
CCLabelAtlas *mapNo = CCLabelAtlas::create("0123456789", "fonts_score_002-hd.png", 38, 44, '0');
if (FruitCrush::shareSingleton()->canPlayMap(no)) {
map = CCSprite::createWithTexture(batch->getTexture());
map->setTag(no);
//map->setScale(0.6);
CCString* num = CCString::createWithFormat("%u", no);
mapNo->setString(num->getCString());
//mapNo->setColor(ccc3(242, 247, 240));
mapNo->setAnchorPoint(ccp(0.5f,0.5f));
mapNo->setPosition(ccp(map->boundingBox().size.width/2, map->boundingBox().size.height/2));
map->addChild(mapNo);
//this->addChild(mapNo);
}
else
{
}
map->setPosition(pos);
map->setScale(0.8);
this->addChild(map);
return map;
}
示例5: tenSecondsCallback
void SecondLevel::tenSecondsCallback(float dt)
{
time -= dt;
if (time < 1)
{
CCDictionary *dict = CCDictionary::createWithContentsOfFile("/word/words.xml");
const char *lose_word = ((CCString*)dict->objectForKey("lose"))->m_sString.c_str();
CCLabelTTF *lose = CCLabelTTF::create(lose_word, "Arial", 24);
lose->setColor(ccc3(255, 0, 0));
lose->setPosition(ccp(150, 150));
result->addChild(lose);
int score = userDefault->getIntegerForKey("score");
stringstream ss;
ss << (score);
CCLabelAtlas *lable = CCLabelAtlas::create(ss.str().c_str(), "/pic/numbers.png", 23, 26, '0');
lable->setPosition(ccp(150, 100));
result->addChild(lable);
result->setVisible(true);
this->unschedule(schedule_selector(SecondLevel::tenSecondsCallback));
}
char time_str[20];
sprintf(time_str, "%d", (int)time);
CCLabelBMFont *label1 = (CCLabelBMFont *)this->getChildByTag(15);
label1->setString(time_str);
}
示例6: letter
Letter::Letter(char letter, size_t id): letter(toupper(letter)), id(id){
// TODO - нужно либо делать rect метод чтобы правильный размер сделать
// либо он на автомате будет работать. я не знаю
CCSprite::init();
//this->setTouchEnabled(true);
this->autorelease();
// TODO 1 раз получать - для всех использовать потом
letterImage = CCSprite::create("letter32_2.png");
letterImage->setScale(32 / letterImage->getContentSize().width);
char arr[2] = {this->letter, '\0'};
//CCLabelTTF *letterLabel = CCLabelTTF::create(arr, "fonts/Schwarzwald Regular.ttf", 22);
//CCLabelTTF *left = CCLabelTTF::create("alignment left", pFont, fontSize,
// blockSize, kCCTextAlignmentLeft, verticalAlignment[vAlignIdx]);
//CCLabelTTF *letterLabel = CCLabelTTF::create(arr, /*"fonts\sylfaen.ttf"*/"Sylfaen", 50);
//CCLabelBMFont *letterLabel = CCLabelBMFont::create(arr, "fonts/hd/markerFelt.fnt", 10);
//letterLabel->setScale(0.5);
CCLabelAtlas *letterLabel = CCLabelAtlas::create(arr, "fonts/hd/larabie-16.plist");
letterLabel->setAnchorPoint(ccp(0.5f, 0.5f));
letterLabel->setColor(ccc3(85,47,17));
//letterLabel->setColor(ccc3(0,0,0));
this->addChild(letterImage,1);
this->addChild(letterLabel,2);
}
示例7: sprintf
void MarketScene::updateLabelAtlas(int num, int tag)
{
char txt[32] = { 0 };
sprintf(txt, "%d", num);
CCLabelAtlas *label = (CCLabelAtlas *)getChildByTag(tag);
label->setString(txt);
}
示例8: sprintf
CCLabelAtlas* DamageValueEffect::CreateAddBloodLabel(unsigned int blood,CCPoint parentPos)
{
CCPoint uiPos = parentPos;
char damageString[10];
sprintf(damageString,"%d",blood);
CCLabelAtlas* lable = CCLabelAtlas::create(damageString,"UI/ui_numble_4.png",41,43,48);
lable->setPosition(uiPos.x,uiPos.y);
lable->setAnchorPoint(ccp(0.5,0.5));
lable->setScale(0);
CCActionInterval* actionScale = CCScaleTo::create(0.01f,2);
CCActionInterval* actionMove = CCMoveBy::create(0.01f,ccp(0,40));
CCSpawn* FirstAction = CCSpawn::createWithTwoActions(actionScale,actionMove);
CCActionInterval* actionFade = CCFadeOut::create(1.0f);
CCActionInterval* bezierAction = CCMoveBy::create(1.0f,ccp(0,80));
CCSpawn* SecondAction = CCSpawn::createWithTwoActions(bezierAction,actionFade);
lable->runAction(CCSequence::create(FirstAction,CCScaleTo::create(0.05f,0.7f),CCDelayTime::create(0.2f),SecondAction,
NULL));
if(m_pDamageLabels->find(lable) == m_pDamageLabels->end())
{
m_pDamageLabels->insert(make_pair(lable,1.3f));
if(GameManager::Get()->GetSceneLayer() != NULL && GameManager::Get()->GetSceneLayer()->getLevelLayer() != NULL
&& GameManager::Get()->GetSceneLayer()->getLevelLayer()->getObjectLayer())
{
GameManager::Get()->GetSceneLayer()->getLevelLayer()->getObjectLayer()->addChild(lable,MAP_Z_OBJ_TOP);
}
}
return lable;
}
示例9: setLeverNum
void RatingSprite::setLeverNum(int num){
CCLabelAtlas* numbrer =(CCLabelAtlas*) this->getChildByTag(2);
char* temp=new char[12];
sprintf(temp,"%d",num);
numbrer->setString(temp);
delete temp;
}
示例10: getChildByTag
void ParticleMainScene::step(float dt)
{
CCLabelAtlas *atlas = (CCLabelAtlas*) getChildByTag(kTagLabelAtlas);
CCParticleSystem *emitter = (CCParticleSystem*) getChildByTag(kTagParticleSystem);
char str[10] = {0};
sprintf(str, "%4d", emitter->getParticleCount());
atlas->setString(str);
}
示例11: setStarCount
void IOSStoreLayer::setStarCount(int num)
{
CCLabelAtlas* pTipStr = (CCLabelAtlas*)m_pBg->getChildByTag(star_count_str_tag);
if (pTipStr)
{
pTipStr->setString(CCString::createWithFormat("%d", num)->getCString());
}
this->setKaiBaoxiangBtnVisiable();
}
示例12: initWithColor
ParticleDemo::ParticleDemo(void)
{
initWithColor( ccc4(127,127,127,255) );
m_emitter = NULL;
setIsTouchEnabled( true );
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 28);
addChild(label, 100, 1000);
label->setPosition( CCPointMake(s.width/2, s.height-50) );
CCLabelTTF *tapScreen = CCLabelTTF::labelWithString("(Tap the Screen)", "Arial", 20);
tapScreen->setPosition( CCPointMake(s.width/2, s.height-80) );
addChild(tapScreen, 100);
CCMenuItemImage* item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) );
CCMenuItemImage* item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) );
CCMenuItemImage* item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ParticleDemo::nextCallback) );
CCMenuItemToggle* item4 = CCMenuItemToggle::itemWithTarget( this,
menu_selector(ParticleDemo::toggleCallback),
CCMenuItemFont::itemFromString( "Free Movement" ),
CCMenuItemFont::itemFromString( "Relative Movement" ),
CCMenuItemFont::itemFromString( "Grouped Movement" ),
NULL );
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, item4, NULL);
menu->setPosition( CCPointZero );
item1->setPosition( CCPointMake( s.width/2 - 100,30) );
item2->setPosition( CCPointMake( s.width/2, 30) );
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
item4->setPosition( CCPointMake( 0, 100) );
item4->setAnchorPoint( CCPointMake(0,0) );
addChild( menu, 100 );
CCLabelAtlas* labelAtlas = CCLabelAtlas::labelWithString("0000", "fonts/fps_images.png", 16, 24, '.');
addChild(labelAtlas, 100, kTagLabelAtlas);
labelAtlas->setPosition( CCPointMake(s.width-66,50) );
// moving background
m_background = CCSprite::spriteWithFile(s_back3);
addChild(m_background, 5);
m_background->setPosition( CCPointMake(s.width/2, s.height-180) );
CCActionInterval* move = CCMoveBy::actionWithDuration(4, CCPointMake(300,0) );
CCActionInterval* move_back = move->reverse();
CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
m_background->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq) );
schedule( schedule_selector(ParticleDemo::step) );
}
示例13: ResetAxeNum
void CWaterpump::ResetAxeNum(cocos2d::CCMenuItemSprite *pItem, int num)
{
CCLabelAtlas *pItemFnt = dynamic_cast<CCLabelAtlas*>(pItem->getChildByTag(Tag_ItemFnt));
if (NULL != pItemFnt)
{
char szNum[8] = {0};
sprintf(szNum, "%d", num);
pItemFnt->setString(szNum);
}
}
示例14: step
void ParticleDemo::step(ccTime dt)
{
if (m_emitter)
{
CCLabelAtlas* atlas = (CCLabelAtlas*)getChildByTag(kTagLabelAtlas);
char str[5] = {0};
sprintf(str, "%04d", m_emitter->getParticleCount());
atlas->setString(str);
}
}
示例15: CCLabelAtlas
//CCLabelAtlas - Creation & Init
CCLabelAtlas * CCLabelAtlas::labelWithString(const char *label, StreamSource* charMapSource, unsigned int itemWidth, int unsigned itemHeight, unsigned char startCharMap)
{
CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet && pRet->initWithString(label, charMapSource, itemWidth, itemHeight, startCharMap))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet)
return NULL;
}