本文整理汇总了C++中LabelAtlas::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelAtlas::setAnchorPoint方法的具体用法?C++ LabelAtlas::setAnchorPoint怎么用?C++ LabelAtlas::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelAtlas
的用法示例。
在下文中一共展示了LabelAtlas::setAnchorPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showHistorySorceNumber
void GameStart::showHistorySorceNumber()
{
// Game Data
int sorceNumber = 100;
LabelAtlas * labelNumber = LabelAtlas::create(String::createWithFormat("%d",sorceNumber)->_string,"fh_shuzi.png",22,32,48);
labelNumber->setAnchorPoint(Vec2(0.0, 0.5));
labelNumber->setPosition(Vec2(visibleSize.width / 2 + 50, visibleSize.height / 2 - 150));
addChild(labelNumber);
}
示例2: showGoldNumber
void GameShopLayer::showGoldNumber()
{
// GameData
int goldNumber = 1000;
LabelAtlas * goldLabel = LabelAtlas::create(String::createWithFormat("%d", goldNumber)->_string, "gameShop/sc_shuzi.png",14,19,48);
goldLabel->setAnchorPoint(Vec2(0.0, 0.5));
goldLabel->setPosition(Vec2(visibleSize.width / 2 - 120, visibleSize.height / 2 + 157));
addChild(goldLabel);
}
示例3: showCurrcertSorceNumber
void GameStart::showCurrcertSorceNumber()
{
// GameData
int currcertSorce = GameData::getInstance()->getCurrcertSorce();
LabelAtlas * CurrcertSorce = LabelAtlas::create(String::createWithFormat("%d", currcertSorce)->_string, "yx_shuzi.png", 18, 24, 48);
CurrcertSorce->setAnchorPoint(Vec2(0.0, 0.5));
CurrcertSorce->setPosition(Vec2(visibleSize.width / 2 + 120, visibleSize.height / 2 + 330));
addChild(CurrcertSorce);
}
示例4: init
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
MenuItemFont* pIncrease = MenuItemFont::create("increase 20",CC_CALLBACK_1(HelloWorld::increaseCallback,this));
pIncrease->setAnchorPoint(Vec2(0.0f,1.0f));
pIncrease->setPosition(0.0f,visibleSize.height - 0.0f);
MenuItemFont* pReduce = MenuItemFont::create("reduce 20",CC_CALLBACK_1(HelloWorld::reduceCallback,this));
pReduce->setAnchorPoint(Vec2(0.0f,1.0f));
pReduce->setPosition(0.0f,visibleSize.height - 40.0f);
MenuItemFont* pGoto = MenuItemFont::create("goto 100",CC_CALLBACK_1(HelloWorld::gotoCallback,this));
pGoto->setAnchorPoint(Vec2(0.0f,1.0f));
pGoto->setPosition(0.0f,visibleSize.height - 80.0f);
Menu* pMenu = Menu::create(pIncrease,pReduce,pGoto, NULL);
pMenu->setPosition(Vec2(0.0f,0.0f));
this->addChild(pMenu, 1);
LabelAtlas* pNumber = LabelAtlas::create("","number.png",55,84,'0');
pNumber->setAnchorPoint(Vec2(0.5f,0.5f));
pNumber->setPosition(Vec2(visibleSize.width/2.0f,
visibleSize.height/2.0f));
this->addChild(pNumber);
m_numberCount.setLabelAtlas(pNumber); //如果是从cocostudio导出的话请调用NumberCount::setTextAtlas
//将数字每一步的增量初始化为3
m_numberCount.setNumberDelta(3);
//将数字增加时间间隔设置为0.1秒
m_numberCount.setTimeDelta(0.1f);
//将数字初始化为100
m_numberCount.setNumber(100,false);
return true;
}