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


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

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


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

示例1: getSpriteOfZhuangbei

BaseSprite* ImageManager::getSpriteOfZhuangbei(string equipKeyWords,ZhuangbeiColourExt color,unsigned holdNum,vector<ItemsType> diamonds,QianghuaData qinghua,unsigned int jingLianTime /* = 0 */)
{
	std::string pic_file = "minute_" + equipKeyWords + ".png";

	BaseSprite* sprite = BaseSprite::create(pic_file);

	BaseSprite* hole1 = BaseSprite::create();
	BaseSprite* hole2 = BaseSprite::create();
	BaseSprite* hole3 = BaseSprite::create();

	// 精炼
	{
		if (jingLianTime > 0)
		{
			//BaseSprite* icon = BaseSprite::create("gongjiang_jinglian_tubiao.png");
			BaseSprite* icon = BaseSprite::create();
			icon->setContentSize(CCSizeMake(20,50));
			char temp[16];
			sprintf(temp,"+%u",jingLianTime);
			CCLabelTTF* lableNum = CCLabelTTF::create(temp,fontStr_BookAntiqua,40,CCSizeMake(0,0),kCCTextAlignmentRight);
			lableNum->setAnchorPoint(ccp(1.0f,0.5f));

			//{
			//	ccColor3B lableColor;
			//	switch (color)
			//	{
			//	case ImageManager::ZhuangbeiColourExt_Baizhuang:
			//		//lableColor = get
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_Fumo:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_Xiyou:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_Chuanqi:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_ChuanQiTaoZhuang:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_ShengBing:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_ShengBingTaoZhuang:
			//		break;
			//	default:
			//		break;
			//	}
			//	lableNum->setColor(lableColor);
			//}

			
			sprite->addChild(lableNum);
			sprite->addChild(icon);
			icon->setPositionY(sprite->getContentSize().height - icon->getContentSize().height/2);
			lableNum->setPosition(ccp(sprite->getContentSize().width - lableNum->getContentSize().width/2,icon->getPositionY()));
			icon->setPositionX(lableNum->getPositionX() - lableNum->getContentSize().width/2 - icon->getContentSize().width/2);
		}
	}

	// 强化
	{

		//sort
		for(int i=0; i<qinghua.qianghua_count; ++i)
		{
			for(int j=i; j<qinghua.qianghua_count; ++j)
			{
				if(  (qinghua.info_arr[i].level < qinghua.info_arr[j].level)   
					|| (qinghua.info_arr[i].level == qinghua.info_arr[j].level && 
					qinghua.info_arr[i].percent < qinghua.info_arr[j].percent)  )
				{
					swap(qinghua.info_arr[i], qinghua.info_arr[j]);
				}
			}
		}

		//float scale = 0.32f/(124/297.0f);
		float scale = 0.3f/(124/297.0f);
		BaseSprite* temp = BaseSprite::create("gongjiang_qianghua_jieguo_jin.png");
		float posX = temp->getContentSize().width/2 * scale;
		float posY = temp->getContentSize().height/2;

		for (int i=0;i<qinghua.max_qianghua_time;i++)
		{
			BaseSprite* imageStar = NULL;
			if (i < qinghua.qianghua_count)
			{
				switch (qinghua.info_arr[i].level)
				{
				case 4:
				case QianghuaLevel_jin_special:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_jin.png");
					break;
				case 3:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_yin.png");
					break;
				case 2:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_tong.png");
					break;
				case 1:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_tie.png");
					break;
				default:
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:ImageManager.cpp


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