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


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

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


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

示例1: clickXilianJingHua

void ZhuangbeiXilianUI::clickXilianJingHua(CCObject *obj)
{
	if (m_dInfoDialog)
	{
		m_dInfoDialog->removeFromParent();
		m_dInfoDialog = NULL;
	}
	string tishiStr = LFStrings::getValue("XilianJingHuaShuoMing");
	string cailiaoFileStr = "daoju_youlanzhiye.png";

	//弹框背景
	BaseSprite* dialog = BaseSprite::create("gongjiang_duanzao_cailiaobuzu_tanchukuang.png");
	dialog->setPosition(ccp(mWinSize.width/2, mWinSize.height/2 + 50));
	//提示
	{
		BaseSprite *cailiaoBg = BaseSprite::create("daoju_kuang_bg.png");
		dialog->addChild(cailiaoBg);
		cailiaoBg->setPosition(ccp(cailiaoBg->getContentSize().width/2 + 10, dialog->getContentSize().height/2));
		BaseSprite *cailiaoImg = BaseSprite::create(cailiaoFileStr);
		cailiaoBg->addChild(cailiaoImg);
		cailiaoImg->setPosition(ccp(cailiaoBg->getContentSize().width/2, cailiaoBg->getContentSize().height/2));

		CCLabelTTF* lable = CCLabelTTF::create(tishiStr.c_str(), fontStr_kaiti,20,CCSize(240, 0), kCCTextAlignmentLeft);
		dialog->addChild(lable);
		lable->setAnchorPoint(ccp(0,0.5));
		lable->setPosition(ccp(cailiaoBg->getPositionX()+cailiaoBg->getContentSize().width/2 , dialog->getContentSize().height/2));
	}
	//按键
	CCMenu* menu = CCMenu::create();
	{
		CCMenuItemImage* item = CCMenuItemImage::create(
			"gongjiang_duanzao_cailiaobuzu_tanchukuang.png",
			"gongjiang_duanzao_cailiaobuzu_tanchukuang.png",
			this, menu_selector(ZhuangbeiXilianUI::clickCiaoliaoShuoMing));
		menu->addChild(item);
		item->setPosition(ccp(dialog->getContentSize().width/2, dialog->getContentSize().height/2));
		item->setOpacity(0);
		item->setScaleX(mWinSize.width / dialog->getContentSize().width);
		item->setScaleY(mWinSize.height / dialog->getContentSize().height);
		// 		item->setScaleX(mWinSize.width / item->getContentSize().width);
		// 		item->setScaleY(mWinSize.height / item->getContentSize().height);
	}
	//弹框
	{

		LFAlert* lfAlert = new LFAlert();
		lfAlert->setBaseContainer(dialog,menu);
		CCDirector::sharedDirector()->getRunningScene()->addChild(lfAlert,128);
		lfAlert->release();
		m_dInfoDialog = lfAlert;
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:52,代码来源:ZhuangbeiXilianUI.cpp

示例2: tableCellAtIndex

CCTableViewCell* TanSuoLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCTableViewCell *cell = table->dequeueCell();
	if (cell != NULL)
	{
		cell->removeAllChildren();
	}
	else 
	{
		cell = new CCTableViewCell();
		cell->autorelease();
	}

	if (table->getParent() != NULL)
	{
		CCSize cellSize = tableCellSizeForIndex(table, idx);
		Profession profId = mHeros.at(idx)->getCurrentProperty().profession;

		//head  Profession 1-10
		BaseSprite *headImg = BaseSprite::create(ImageManager::getManager()->getImageData_ProfessionHead(profId).getCurrentImageFile());
		cell->addChild(headImg);
		headImg->setPosition(ccp(cellSize.width/2, 92));

		//menu
		FXScrollMenu *menu = FXScrollMenu::create(
			table->getParent()->convertToWorldSpace(table->getPosition()), table->getViewSize());
		cell->addChild(menu, 1);
		menu->setPosition(ccp(0,0));
		CCMenuItemImage *item = CCMenuItemImage::create(
			"renxing_renwu_touxiang.png",
			"renxing_renwu_touxiang_select.png", 
			"renxing_renwu_touxiang_select.png", 
			this, menu_selector(TanSuoLayer::menuItemClicked_JieFenHeroSelect));
		menu->addChild(item, 0, profId);

		m_lMenuItemList.push_back(item);

		item->setPosition(headImg->getPosition());
		//name
		CCLabelTTF *nameLabel = CCLabelTTF::create(BaseActorPropertyParser::getParser()->getExtraProerty(profId).nameInChinese.c_str()
			, fontStr_kaiti, m_nFontSize);
		cell->addChild(nameLabel);
		nameLabel->setPosition(ccp(headImg->getPositionX()
			, headImg->getPositionY()-headImg->getContentSize().height/2-nameLabel->getContentSize().height/2));
		nameLabel->setColor(ccc3(195, 145, 96));
	}

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

示例3: displayXiangQing

void MailInfoListLayer::displayXiangQing(Flat_DuanzaoGroupZBInfo zbInfo)
{
	//this->disableAllTouchBegin();
	mCurTaoZhuang_Info = zbInfo;

	

	BaseSprite *board = BaseSprite::create("zhuangbei_xiangxi_mianban.png");
	
	/*BaseLayer *layer = new BaseLayer();
	layer->setContentSize(board->getContentSize());
	layer->setPosition(board->getPosition());
	layer->addChild(board);*/
	CCDirector::sharedDirector()->getRunningScene()->addChild(board,1030);

	//MainLayerBase::getCurrentMainBase()->getHeader()->setContent(BaseSprite::create());
	//MainLayerBase::getCurrentMainBase()->setContaintLayer(layer,false);
	//layer->release();
	refreshEquipBoard(board, zbInfo);
	board->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2 + 106));

	ListMenu *menu = ListMenu::create();
	board->addChild(menu, 10);
	menu->setPosition(CCPointZero);
	//	menu->setTouchPriority(-131);
	BaseSprite *norImg = BaseSprite::create("close.png");
	BaseSprite *selImg = BaseSprite::create("close_select.png");
	CCMenuItemSprite *item = CCMenuItemSprite::create(norImg, selImg, NULL, this, menu_selector(MailInfoListLayer::menuItemClicked_close));
	menu->addChild(item, 0);
	item->setPosition(ccp(board->getContentSize().width-44+12, board->getContentSize().height-36+2));
	//底纹
	ImageData diWenData = ImageManager::getManager()->getImageData_DiWen_XiangQing(
		zbInfo.zhuangbei_colour
		, false
		, SuitPool::getPool()->isSuit(zbInfo.zb_group_id));
	BaseSprite* diWen = BaseSprite::create(diWenData.getCurrentImageFile());
	diWen->setScale(0.7f);
	board->addChild(diWen);
	diWen->setPosition(ccp(123, 838-240+122));
	// 装备图片
	string equipfile = zbInfo.zhuangbei_pic;
	equipfile = "minute_" + equipfile + ".png";
	BaseSprite *s = BaseSprite::create(equipfile);
	diWen->addChild(s);
	s->setPosition(ccp(diWen->getContentSize().width/2,diWen->getContentSize().height/2));
	//套装按钮
	if(SuitPool::getPool()->isSuit(zbInfo.zb_group_id))
	{
		string norStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang.png";
		string selStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_select.png";
		// 		if (ChuanqiPool::getPool()->isShenBing(mEquipVec.at(idx).zb_group_id))
		// 		{
		// 			norStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_shenbing.png";
		// 			selStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_shenbing_select.png";
		// 		}  
		CCMenuItemImage *taozhuangItem = CCMenuItemImage::create(
			norStr.c_str()
			, selStr.c_str()
			, this ,menu_selector(MailInfoListLayer::menuItemClicked_equipDetailMenu));
		menu->addChild(taozhuangItem, 0);
		taozhuangItem->setAnchorPoint(ccp(1, 0));
		taozhuangItem->setPosition(ccp(diWen->getPositionX()+diWen->getContentSize().width/2*diWen->getScaleX()
			, diWen->getPositionY()-diWen->getContentSize().height/2*diWen->getScaleY()));
		taozhuangItem->setEnabled(false);
	}
	m_dEquimentDialog = board;
	m_mDEquipmentMenu = menu;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:68,代码来源:MailInfoListLayer.cpp


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