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


C++ CCControlButton::setAdjustBackgroundImage方法代码示例

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


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

示例1:

CTableSprite CStar97Game::CreateTableSprite()
{
	CTableSprite tableSprite;
	CCSize szBKSize;

	if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Cfg, Star97_Room_Table, tableSprite.m_pTableBK))
	{
		szBKSize = tableSprite.m_pTableBK->getContentSize();
		tableSprite.m_pTableBK->setAnchorPoint(ccp(0.5f, 0.5f));
		tableSprite.m_pTableBK->setScale(1.4f);
	}
	if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Cfg, Star97_Room_Table_P, tableSprite.m_pTableP))
	{
		szBKSize = tableSprite.m_pTableP->getContentSize();
		tableSprite.m_pTableP->setAnchorPoint(ccp(0.0f, 0.0f));
		tableSprite.m_pTableP->setPosition(CCPoint(0,0));
		tableSprite.m_pTableP->setZOrder(tableSprite.m_pTableBK->getZOrder()+1);
		tableSprite.m_pTableBK->addChild(tableSprite.m_pTableP);
	}
	//桌子编号
	if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Base, Star97_Room_Table_Num_Font, tableSprite.m_pTableNum))
	{
		szBKSize = tableSprite.m_pTableBK->getContentSize();
		tableSprite.m_pTableNum->setAnchorPoint(ccp(0.5, 0.5));
		tableSprite.m_pTableNum->setPosition(ccp(120.f,240.f));
		//tableSprite.m_pTableNum->setScale(0.3f);
		if (NULL != tableSprite.m_pTableBK)
		{
			tableSprite.m_pTableBK->addChild(tableSprite.m_pTableNum);
		}
	}

	//游戏桌子编号
	if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Base, Star97_Room_Table_Num_Font, tableSprite.m_pTableNumP))
	{
		tableSprite.m_pTableNumP->setAnchorPoint(ccp(0.5, 0.5));
		tableSprite.m_pTableNumP->setPosition(ccp(120.f,240.f));
		//tableSprite.m_pTableNumP->setScale(0.3f);
		if (NULL != tableSprite.m_pTableP)
		{
			tableSprite.m_pTableP->addChild(tableSprite.m_pTableNumP);
		}
	}

	//座位
	for (int n = 0; n < 1; n++)
	{
		CSeatSprite seat;

		CCLabelTTF *titleButton = CCLabelTTF::create("", "Arial", 30);
		if (NULL == titleButton)
		{
			ERROR_CHECK;
			break;
		}
		titleButton->setColor(ccc3(159, 168, 176));

		CCScale9Sprite *backgroundButton = NULL;
		if (!m_pResManager->GenerateNodeByCfgID(eSpriteType_Cfg, Star97_Room_Sit, backgroundButton))
		{
			ERROR_CHECK;
			break;
		}

		CCControlButton* pButton = CMoveableButton::create(titleButton, backgroundButton);
		if (NULL == pButton)
		{
			ERROR_CHECK;
			break;
		}

		CCScale9Sprite *backgroundHighlightedButton = NULL;
		if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Cfg, Star97_Room_Sit, backgroundHighlightedButton))
		{
			pButton->setBackgroundSpriteForState(backgroundHighlightedButton, CCControlStateHighlighted);
		}

		CCScale9Sprite *backgroundDisibleButton = NULL;
		if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Cfg, Star97_Room_Sit_D, backgroundDisibleButton))
		{
			pButton->setBackgroundSpriteForState(backgroundDisibleButton, CCControlStateDisabled);
		}

		pButton->setPosition(CCPoint(134.0f,105.0f));
		pButton->setAdjustBackgroundImage(false);
		//pButton->setZoomOnTouchDown(false);
		pButton->setTag(n);
		if (tableSprite.m_pTableP)
		{
			pButton->setZOrder(tableSprite.m_pTableP->getZOrder()+4);
		}

		tableSprite.m_pTableBK->addChild(pButton);
		seat.m_pSeat = pButton;

		//更新名称
		CCLabelTTF* pUserName = NULL; 

		if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Cfg, Star97_Font_Room_Sit_Name, pUserName))
		{
//.........这里部分代码省略.........
开发者ID:hantingmeixue,项目名称:Aoyi,代码行数:101,代码来源:Star97Game.cpp


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