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


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

本文整理汇总了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) ); 
}
开发者ID:ioyouj,项目名称:Hello-LWF-Cocos2d-x,代码行数:20,代码来源:LabelTest.cpp

示例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());
	}
}
开发者ID:DreamZL,项目名称:PlaneFight,代码行数:48,代码来源:LayerGameMain.cpp


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