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


C++ LabelAtlas::setAnchorPoint方法代码示例

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

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

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

示例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;
}
开发者ID:0xiaohui00,项目名称:Cocos2dxUsefulClasses,代码行数:47,代码来源:HelloWorldScene.cpp


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