本文整理汇总了C++中CCMenu::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenu::setColor方法的具体用法?C++ CCMenu::setColor怎么用?C++ CCMenu::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenu
的用法示例。
在下文中一共展示了CCMenu::setColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool MainMenu::init()
{
if(CCLayer::init())
{
CCSprite *bg = CCSprite::create("bg.png");
bg->setPosition(ccp(240, 160));
this->addChild(bg);
CCMenuItemFont *item1 = CCMenuItemFont::create("interval");
CCMenuItemFont *item2 = CCMenuItemFont::create("intant");
CCMenuItemFont *item3 = CCMenuItemFont::create("speed");
CCMenuItemFont *item4 = CCMenuItemFont::create("follow");
CCMenuItemFont *item5 = CCMenuItemFont::create("manager");
item1->setTarget(this, menu_selector(MainMenu::actionIntervalCallBack));
item2->setTarget(this, menu_selector(MainMenu::actionIntantCallBack));
item3->setTarget(this, menu_selector(MainMenu::actionSpeedCallBack));
item4->setTarget(this, menu_selector(MainMenu::actionFollowCallBack));
item5->setTarget(this, menu_selector(MainMenu::actionManagerCallBack));
CCMenu *menu = CCMenu::create(item1,item2,item3,item4,item5,NULL);
menu->setColor(ccc3(0, 255, 0));
menu->alignItemsInColumns(1,2,2);
menu->setPosition(ccp(240,160));
this->addChild(menu);
return true;
}
return false;
}
示例2: init
bool VictoryScene::init()
{
bool bRet = false;
do
{
CCDirector * pDirector;
CC_BREAK_IF( ! (pDirector = CCDirector::sharedDirector()) );
this->setContentSize(pDirector->getWinSize());
CCSprite* pSprite = CCSprite::create("victory.png");
// position the sprite on the center of the screen
pSprite->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width * 0.5 , CCDirector::sharedDirector()->getVisibleSize().height * 0.5));
// add the sprite as a child to this layer
addChild(pSprite, -1);
//create menu for game victory
CCMenuItemFont* backMenu = CCMenuItemFont::create("Back To Menu",this,menu_selector(GameScene::menuPopSceneCallback));
CCMenuItemFont* exit = CCMenuItemFont::create("Exit",this,menu_selector(GameOverScene::menuCloseCallback));
CCMenu* menu;
/* if (pItem!= NULL)
{
menu = CCMenu::create(pItem,backMenu,exit,NULL);
}
else
{*/
menu = CCMenu::create(backMenu,exit,NULL);
//}
menu->alignItemsVertically();
menu->setColor(ccc3(0,0,0));
addChild(menu,3);
// success
bRet = true;
} while (0);
return bRet;
}
示例3: init
bool ActionSequence::init()
{
if(CCLayer::init())
{
CCSprite *bg = CCSprite::create("bg.png");
bg->setPosition(ccp(240, 160));
this->addChild(bg);
CCMenuItemImage *itemImage = CCMenuItemImage::create("b1.png", "b2.png");
itemImage->setTarget(this, menu_selector(ActionSequence::back));
CCMenu *backMenu = CCMenu::create(itemImage,NULL);
backMenu->setPosition(ccp(50,280));
this->addChild(backMenu);
CCMenuItemFont *item1 = CCMenuItemFont::create("CCSequence");
CCMenuItemFont *item2 = CCMenuItemFont::create("CCSpawn");
item1->setTarget(this, menu_selector(ActionSequence::showSequence));
item2->setTarget(this, menu_selector(ActionSequence::showSpawn));
CCMenu *menu = CCMenu::create(item1,item2,NULL);
menu->setColor(ccc3(0, 255, 0));
menu->alignItemsInColumns(1,1);
menu->setPosition(ccp(240,80));
this->addChild(menu);
mySprite = CCSprite::create("bird.png");
mySprite->setPosition(ccp(60, 180));
this->addChild(mySprite);
return true;
}
return false;
}
示例4: init
bool Level::init()
{
if (!CCLayer::init()) {
return false;
}
/*预加载音效*/
SimpleAudioEngine::sharedEngine()->preloadEffect("confirm.mp3");
/*添加背景*/
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCSprite* spBackGround = CCSprite::create("levelBackground.png");
spBackGround->setPosition(ccp(size.width*0.5, size.height*0.5));
addChild(spBackGround);
/*创建图片菜单项*/
CCMenuItemImage *item1 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel1));
CCMenuItemImage *item2 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel2));
CCMenuItemImage *item3 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel3));
CCMenuItemImage *item4 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel4));
CCMenuItemImage *item5 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel5));
/*创建返回菜单项*/
CCMenuItemImage *itemBack = CCMenuItemImage::create("display_back.png", "display_back.png", this, menu_selector(Level::backToMenu));;
/*设置菜单项大小*/
item1->setScale(0.45);
item2->setScale(0.45);
item3->setScale(0.45);
item4->setScale(0.45);
item5->setScale(0.45);
/*创建菜单*/
CCMenu* menu1 = CCMenu::create(item1, item2, item3, item4, item5, NULL);
menu1->setPosition(ccp(size.width * 0.5, size.height * 0.55));
menu1->alignItemsHorizontallyWithPadding(70);
CCMenu* menuBack = CCMenu::create(itemBack, NULL);
addChild(menuBack);
menuBack->setPosition(ccp(size.width * 0.36, size.height * 0.05));
menuBack->setScale(0.7);
menuBack->setColor(ccc3(0, 32, 240));
/*创建图片菜单项*/
CCMenuItemImage *item6 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel6));
CCMenuItemImage *item7 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel7));
CCMenuItemImage *item8 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel8));
CCMenuItemImage *item9 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel9));
CCMenuItemImage *item10 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel10));
/*设置菜单项大小*/
item6->setScale(0.45);
item7->setScale(0.45);
item8->setScale(0.45);
item9->setScale(0.45);
item10->setScale(0.45);
/*创建菜单*/
CCMenu* menu2 = CCMenu::create(item6, item7, item8, item9, item10, NULL);
menu2->setPosition(ccp(size.width * 1.5, size.height * 0.55));
menu2->alignItemsHorizontallyWithPadding(70);
/*-----------------------*/
/*创建图片菜单项*/
CCMenuItemImage *item11 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel11));
CCMenuItemImage *item12 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel12));
CCMenuItemImage *item13 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel13));
CCMenuItemImage *item14 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel14));
CCMenuItemImage *item15 = CCMenuItemImage::create("level_normal.png", "level_selected.png", this, menu_selector(Level::chooseLevel15));
/*设置菜单项大小*/
item11->setScale(0.45);
item12->setScale(0.45);
item13->setScale(0.45);
item14->setScale(0.45);
item15->setScale(0.45);
/*创建菜单*/
CCMenu* menu3 = CCMenu::create(item11, item12, item13, item14, item15, NULL);
menu3->setPosition(ccp(size.width * 2.5, size.height * 0.55));
menu3->alignItemsHorizontallyWithPadding(70);
/*添加关卡锁*/
lock2 = CCSprite::create("lock.png");
lock3 = CCSprite::create("lock.png");
lock4 = CCSprite::create("lock.png");
lock5 = CCSprite::create("lock.png");
lock6 = CCSprite::create("lock.png");
lock7 = CCSprite::create("lock.png");
lock8 = CCSprite::create("lock.png");
lock9 = CCSprite::create("lock.png");
lock10 = CCSprite::create("lock.png");
lock11 = CCSprite::create("lock.png");
lock12 = CCSprite::create("lock.png");
lock13 = CCSprite::create("lock.png");
lock14 = CCSprite::create("lock.png");
lock15 = CCSprite::create("lock.png");
item2->addChild(lock2);
//.........这里部分代码省略.........