本文整理汇总了C++中CCMenuItemImage::setDisabledSpriteFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemImage::setDisabledSpriteFrame方法的具体用法?C++ CCMenuItemImage::setDisabledSpriteFrame怎么用?C++ CCMenuItemImage::setDisabledSpriteFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemImage
的用法示例。
在下文中一共展示了CCMenuItemImage::setDisabledSpriteFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildAndPlaceTile
CCMenuItemImage* BaseScene::buildAndPlaceTile(const char *normalFrameName, const char *selectedFrameName, int tilePosX, int tilePosY)
{
CCMenuItemImage* menuButton = CCMenuItemImage::create();
menuButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(normalFrameName));
menuButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(selectedFrameName));
menuButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(selectedFrameName));
//menuButton->setTarget(this, menu_selector(HomeScene::getZOrder));
menuButton->setAnchorPoint(ccp(0.0, 1.0));
_tileMenu->addChild(menuButton);
float onePosX = AppDelegate::SCREEN_WIDTH * 0.348;
float onePosY = AppDelegate::SCREEN_HEIGHT * 0.764;
float tileHeight = menuButton->getContentSize().height;
float gap = 7 * AppDelegate::SCREEN_SCALE_FACTOR;
float desiredPosX = onePosX + ((gap + tileHeight) * tilePosX);
float desiredPosY = onePosY - ((gap + tileHeight) * tilePosY);
menuButton->setPosition(desiredPosX, desiredPosY);
return menuButton;
}
示例2: buildHeader
void BaseScene::buildHeader(int highlightIndex, const char* title, const char* description)
{
_currentMenuIndex = highlightIndex;
CCMenuItemImage* homeButton = CCMenuItemImage::create();
homeButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_nrl"));
homeButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_prd"));
homeButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_prd"));
homeButton->setTarget(this, menu_selector(BaseScene::loadHomeScene));
homeButton->setAnchorPoint(ccp(1.0f, 1.0f));
CCMenuItemImage* fbActionButton = CCMenuItemImage::create();
fbActionButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_nrl"));
fbActionButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_prd"));
fbActionButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_dis"));
fbActionButton->setTarget(this, menu_selector(BaseScene::loadFBActionScene));
fbActionButton->setAnchorPoint(ccp(1.0f, 1.0f));
if (EziSocialObject::sharedObject()->isFacebookSessionActive() == false)
{
fbActionButton->setEnabled(false);
}
CCMenuItemImage* helpButton = CCMenuItemImage::create();
helpButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_nrl"));
helpButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_prd"));
helpButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_prd"));
helpButton->setTarget(this, menu_selector(BaseScene::loadHelpScene));
helpButton->setAnchorPoint(ccp(1.0f, 1.0f));
switch (highlightIndex)
{
case 0:
homeButton->setEnabled(false);
break;
case 1:
fbActionButton->setEnabled(false);
break;
case 2:
helpButton->setEnabled(false);
break;
default:
break;
}
CCMenu* homeMenu = CCMenu::create(homeButton, fbActionButton, helpButton, NULL);
homeMenu->alignItemsHorizontally();
this->addChild(homeMenu);
PlaceNode(homeMenu, 0.88, 0.98);
// Add a line.
CCLayerColor* lineLayer = CCLayerColor::create(ccc4(204, 204, 204, 204),
CCDirector::sharedDirector()->getVisibleSize().width,
1.0 * AppDelegate::SCREEN_SCALE_FACTOR);
this->addChild(lineLayer);
PlaceNode(lineLayer, 0.0, 0.8);
lineLayer->setPositionY(homeMenu->getPositionY() - homeButton->getContentSize().height - (7 * AppDelegate::SCREEN_SCALE_FACTOR));
// Add Title
CCLabelTTF* titleLabel = CCLabelTTF::create(title, "Arial", 50.0 * AppDelegate::SCREEN_SCALE_FACTOR);
this->addChild(titleLabel);
titleLabel->setAnchorPoint(ccp(0.0f, 0.0f));
//PlaceNode(titleLabel, 0.02, 0.98);
CCLabelTTF* descriptionLabel = CCLabelTTF::create(description,
"Arial", SCALED_VALUE(22.0f));
this->addChild(descriptionLabel);
descriptionLabel->setAnchorPoint(ccp(0.0f, 0.0f));
PlaceNode(descriptionLabel, 0.02, 0.98);
descriptionLabel->setPositionY(homeMenu->getPositionY() - homeButton->getContentSize().height);
descriptionLabel->setColor(ccc3(204, 204, 204));
titleLabel->cocos2d::CCNode::setPosition(descriptionLabel->getPositionX(),
descriptionLabel->getPositionY() + descriptionLabel->getContentSize().height - 2.0f);
}