当前位置: 首页>>代码示例>>C++>>正文


C++ CCLabelAtlas类代码示例

本文整理汇总了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;
}
开发者ID:gaochao19860203,项目名称:Defender,代码行数:7,代码来源:GameTipsSprite.cpp

示例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;
}
开发者ID:gaochao19860203,项目名称:Defender,代码行数:7,代码来源:GameTipsSprite.cpp

示例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;
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:34,代码来源:ItemCard.cpp

示例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;
    
}
开发者ID:lioneltsai,项目名称:fruitCrush,代码行数:29,代码来源:LevelScene.cpp

示例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);
}
开发者ID:xujqiao,项目名称:ultraBrain,代码行数:28,代码来源:SecondLevel.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例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);
}
开发者ID:hyper123,项目名称:TurboSnail,代码行数:7,代码来源:MarketScene.cpp

示例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;
}
开发者ID:JamShan,项目名称:xcode_jifengyongzhezhuan,代码行数:29,代码来源:DamageValueEffect.cpp

示例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;
}
开发者ID:joyfish,项目名称:cocos2d-1,代码行数:7,代码来源:RatingSprite.cpp

示例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);
}
开发者ID:0309,项目名称:cocos2d-x,代码行数:9,代码来源:PerformanceParticleTest.cpp

示例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();
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:9,代码来源:IOSStoreLayer.cpp

示例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) );
}
开发者ID:Openxlive,项目名称:cocos2d-x-win8-tests-metro-style,代码行数:56,代码来源:ParticleTest.cpp

示例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);
    }
}
开发者ID:gziproject,项目名称:DragonSlayer,代码行数:10,代码来源:Waterpump.cpp

示例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);
    }
}
开发者ID:geniikw,项目名称:myFirst2DGame,代码行数:10,代码来源:ParticleTest.cpp

示例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;
}
开发者ID:noriter,项目名称:nit,代码行数:12,代码来源:CCLabelAtlas.cpp


注:本文中的CCLabelAtlas类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。