本文整理汇总了C++中LabelBMFont::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelBMFont::setAnchorPoint方法的具体用法?C++ LabelBMFont::setAnchorPoint怎么用?C++ LabelBMFont::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelBMFont
的用法示例。
在下文中一共展示了LabelBMFont::setAnchorPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addChild
Atlas6::Atlas6()
{
auto s = Director::getInstance()->getWinSize();
LabelBMFont* label = NULL;
label = LabelBMFont::create("FaFeFiFoFu", "fonts/bitmapFontTest5.fnt");
addChild(label);
label->setPosition( Point(s.width/2, s.height/2+50) );
label->setAnchorPoint( Point(0.5f, 0.5f) ) ;
label = LabelBMFont::create("fafefifofu", "fonts/bitmapFontTest5.fnt");
addChild(label);
label->setPosition( Point(s.width/2, s.height/2) );
label->setAnchorPoint( Point(0.5f, 0.5f) );
label = LabelBMFont::create("aeiou", "fonts/bitmapFontTest5.fnt");
addChild(label);
label->setPosition( Point(s.width/2, s.height/2-50) );
label->setAnchorPoint( Point(0.5f, 0.5f) );
}
示例2: updateBigBoomCount
void LayerGameMain::updateBigBoomCount(int bigBoomCount)
{
String strBoomCount;
Sprite * norBoom = Sprite::createWithSpriteFrameName("bomb.png");
Sprite * selBoom = Sprite::createWithSpriteFrameName("bomb.png");
if (bigBoomCount < 0)
{
return;
}
else if (bigBoomCount == 0)
{
if (this->getChildByTag(TAG_BIGBOOM))
{
this->removeChildByTag(TAG_BIGBOOM,true);
}
if (this->getChildByTag(TAG_BIGBOOMCOUNT))
{
this->removeChildByTag(TAG_BIGBOOMCOUNT,true);
}
}
else if (bigBoomCount == 1)
{
if ( !(this->getChildByTag(TAG_BIGBOOM)) )
{
MenuItemSprite * boomItem = MenuItemSprite::create(norBoom,
selBoom,
CC_CALLBACK_1(LayerGameMain::boomMenuCallback,this));
boomItem->setPosition(norBoom->getContentSize().width/2,norBoom->getContentSize().height/2);
Menu * boomMenu = Menu::create(boomItem,nullptr);
boomMenu->setPosition(Point::ZERO);
this->addChild(boomMenu,0,TAG_BIGBOOM);
}
if ( !(this->getChildByTag(TAG_BIGBOOMCOUNT)) )
{
strBoomCount.initWithFormat("X %d",bigBoomCount);
LabelBMFont * labelBoomCount = LabelBMFont::create(strBoomCount.getCString(),"font/font.fnt");
labelBoomCount->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT);
labelBoomCount->setPosition(Point(norBoom->getContentSize().width,norBoom->getContentSize().height - 30));
this->addChild(labelBoomCount,0,TAG_BIGBOOMCOUNT);
}
}
else if (bigBoomCount > 1 && bigBoomCount < MAX_BIGBOOM_COUNT)
{
strBoomCount.initWithFormat("X %d",bigBoomCount);
LabelBMFont * labelCount = (LabelBMFont *)this->getChildByTag(TAG_BIGBOOMCOUNT);
labelCount->setString(strBoomCount.getCString());
}
}