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


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

本文整理汇总了C++中BaseSprite::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseSprite::setAnchorPoint方法的具体用法?C++ BaseSprite::setAnchorPoint怎么用?C++ BaseSprite::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseSprite的用法示例。


在下文中一共展示了BaseSprite::setAnchorPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getItemContentByIndex

BaseSprite* MainLayerHerosBaseBody::getItemContentByIndex(unsigned int index)
{

	BaseSprite* bg = BaseSprite::create("duiwu_yingxiong_bg.png");
	bg->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));

	//图片
	{
		ImageData data = ImageManager::getManager()->getImageData_ProfessionHead((Profession)mHerosVec[index]->getActorType());

		CCLOG("----------------->%s",data.getCurrentImageFile().c_str());
		BaseSprite *sprite = BaseSprite::create( data.getCurrentImageFile());
		BaseSprite *sprite2 = BaseSprite::create( data.getCurrentImageFile());
		BaseSprite *sprite3 = BaseSprite::create( data.getCurrentImageFile());
		CCMenuItemSprite* heroItem = CCMenuItemSprite::create(sprite, sprite2, sprite3, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_heroImg));
		CCMenu* menu = CCMenu::create(heroItem, NULL);
		bg->addChild(menu, 0, TAG_BaseBody_TABLE_HERO_IMG);
		heroItem->setPosition(ccp(74, bg->getContentSize().height/2));
		menu->setPosition(CCPointZero);

		BaseSprite *biankuang = BaseSprite::create("renxing_renwu_touxiang_select.png");
		bg->addChild(biankuang, 1);
		biankuang->setPosition(heroItem->getPosition());
		BaseSprite *item = NULL;
		Profession iType = (Profession)mHerosVec[index]->getActorType();
		if (iType == Profession_Yemanren)
		{
			item = BaseSprite::create("touxiang_jiaobiao_3.png");
		}
		else if (iType == Profession_Chike)
		{
			item = BaseSprite::create("touxiang_jiaobiao_2.png");
		}
		else if (iType == Profession_Fashi)
		{
			item = BaseSprite::create("touxiang_jiaobiao_1.png");
		}
		else if (iType == Profession_Qishi)
		{
			item = BaseSprite::create("touxiang_jiaobiao_3.png");
		}
		else if (iType == Profession_ShenJianShou)
		{
			item = BaseSprite::create("touxiang_jiaobiao_4.png");
		}
		else if (iType == Profession_MiShu)
		{
			item = BaseSprite::create("touxiang_jiaobiao_1.png");
		}
		else if (iType == Profession_WuSeng)
		{
			item = BaseSprite::create("touxiang_jiaobiao_5.png");
		}
		else if (iType == Profession_YouXia)
		{
			item = BaseSprite::create("touxiang_jiaobiao_2.png");
		}
		else if (iType == Profession_LieShou)
		{
			item = BaseSprite::create("touxiang_jiaobiao_4.png");
		}
		else if (iType == Profession_WuShi)
		{
			item = BaseSprite::create("touxiang_jiaobiao_6.png");
		}

		if (item)
		{
			item->setAnchorPoint(ccp(1, 0));
			biankuang->addChild(item);
			item->setPosition(ccp(biankuang->getContentSize().width, 0));
		}		
	}

	//name
	HeroFixedPro info = BaseActorPropertyParser::getParser()->getExtraProerty((Profession)mHerosVec[index]->getActorType());
	LF::lable(bg, info.nameInChinese,ccp(140, 106),22,fontStr_kaiti)->setTag(TAG_BaseBody_LABLE_NAME);

	// 英雄介绍
	{
		Profession profId = mHerosVec[index]->getActorType();
		CCLabelTTF *directionLabel = CCLabelTTF::create(getHeroDirectionByProfessionId(profId).c_str(), fontStr_kaiti, 20, CCSize(380, 0), kCCTextAlignmentLeft);
		bg->addChild(directionLabel, 1, Tag_Label_HeroDirection);
		directionLabel->setColor(ccc3(165, 125, 76));
		directionLabel->setAnchorPoint(ccp(0, 1));
		directionLabel->setPosition(ccp(140, 94));
	}

	if (mFlag == 1)
	{
		CCMenuItemImage* chose = CCMenuItemImage::create(
			"duiwu_yingxiong_weixuanzhong.png"
			, "duiwu_yingxiong_weixuanzhong.png"
			, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_choseHero));
		chose->setPosition(558, 83);
		CCMenu* menu = CCMenu::create(chose, NULL);
		menu->setPosition(CCPointZero);
		bg->addChild(menu, 0, TAG_Menu);

		CCSprite* unlock = CCSprite::create("duiwu_yingxiong_unlock.png", CCRect(0, 0, 610, 129));
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainLayerHerosBaseBody.cpp


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