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


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

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


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

示例1: create

BaseSprite* BaseSprite::create(string fileName)
{
	BaseSprite* s = new BaseSprite();
	s->initWithFile(fileName.c_str());
	s->autorelease();
	return s;
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:7,代码来源:BaseSprite.cpp

示例2: BaseSprite

BaseSprite * BaseSprite::create( const char *fileName )
{
    BaseSprite *bs = new BaseSprite();
    if(bs&&bs->initWithFile(fileName))
    {
        bs->autorelease();
        return bs;
    }
    return NULL;
}
开发者ID:AIRIA,项目名称:Brizzle,代码行数:10,代码来源:BaseSprite.cpp

示例3: getItemContentByIndex


//.........这里部分代码省略.........
			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));
		bg->addChild(unlock, 0, TAG_Unlock);
		unlock->setOpacity(200);
		unlock->setPosition(bg->getPosition());

		int state = mChoseHeroState.at(index);
		if(state>=1 && state<=4) //已选中的
		{
			chose->initWithNormalImage(
				"duiwu_yingxiong_xuanzhong.png"
				, "duiwu_yingxiong_xuanzhong.png"
				, "duiwu_yingxiong_xuanzhong.png"
				, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_choseHero));
			unlock->setVisible(false);
		}
		else if(state == 0 && mChoseNum<3) //未选中 可选的
		{
			chose->initWithNormalImage(
				"duiwu_yingxiong_daixuan.png"
				, "duiwu_yingxiong_daixuan.png"
				, "duiwu_yingxiong_daixuan.png"
				, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_choseHero));
			unlock->setVisible(false);
		}

		else						//选满了、不能选的
		{
			bg->initWithFile("duiwu_yingxiong_bg_suoding.png");
		}

	}
	else if (mFlag == 2)
	{
		if (mHerosVec.at(index)->canUnlock())
		{
			//可解锁
			CCMenuItemImage* kjsItem = CCMenuItemImage::create(
				"duiwu_yingxiong_jiesuo.png"
				, "duiwu_yingxiong_jiesuo.png"
				, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_jiesuoHero));
			kjsItem->setPosition(558, 83);
			kjsItem->setTag(index);
			CCMenu* menu = CCMenu::create(kjsItem, NULL);
			menu->setPosition(CCPointZero);
			bg->addChild(menu, 0, TAG_Menu);
		}
		else //还不能解锁
		{
			//不能解锁
			CCMenuItemImage* kjsItem = CCMenuItemImage::create(
				"duiwu_yingxiong_suoding.png"
				, "duiwu_yingxiong_suoding.png"
				, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_jiesuoHero));
			kjsItem->setPosition(558, 83);
			kjsItem->setTag(index);
			CCMenu* menu = CCMenu::create(kjsItem, NULL);
			menu->setPosition(CCPointZero);
			bg->addChild(menu, 0, TAG_Menu);

			CCSprite* unlock = CCSprite::create("duiwu_yingxiong_unlock.png", CCRect(0, 0, 610, 129));
			bg->addChild(unlock, 0, TAG_Unlock);
			unlock->setOpacity(200);
			unlock->setPosition(bg->getPosition());
		}

	}
	

	return bg;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainLayerHerosBaseBody.cpp


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