本文整理汇总了C++中CCLabelAtlas::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelAtlas::setColor方法的具体用法?C++ CCLabelAtlas::setColor怎么用?C++ CCLabelAtlas::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelAtlas
的用法示例。
在下文中一共展示了CCLabelAtlas::setColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: beAttacked
void RpgPlayer::beAttacked(int atkValue)
{
if (hp <= 0)
{
return;
}
int oldhp = hp;
if (hp >= atkValue)
{
hp -= atkValue;
}
else
{
hp = 0;
}
atkValue = oldhp-hp;
if (atkValue)
{
std::stringstream ss;
ss << atkValue;
//CCLabelAtlas *labelAtlas = CCLabelAtlas::create(ss.str().c_str(),"fps_images.png", 12, 32, '.');
CCLabelAtlas *labelAtlas = CCLabelAtlas::create(ss.str().c_str(),"numbers_1.png", 41.28, 81, '.');
labelAtlas->setVisible(true);
//labelAtlas->setPosition(ccp(125,125));
labelAtlas->setColor(ccc3(255,0,0));
CCAction *spawn = CCSpawn::create(CCMoveBy::create(0.5f,ccp(0,64)),CCFadeOut::create(0.5),NULL);
labelAtlas->runAction(spawn);
this->addChild(labelAtlas,2);
CCSprite::runAction(CCSequence::create(CCDelayTime::create(0.6),
CCCallFuncND::create(this, callfuncND_selector(RpgMonster::actionEnd_removeLabel), (void*)labelAtlas),NULL));
showHp();
tryConbineAction(RpgMonster::ACTION_BE_ATTACK);
}
if (ui)
{
ui->updateHp(this);
}
if (hp <=0)
{
doDeath(); // RpgMonster 将死亡
}
}