本文整理汇总了C++中CCMenuItem::getZOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItem::getZOrder方法的具体用法?C++ CCMenuItem::getZOrder怎么用?C++ CCMenuItem::getZOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItem
的用法示例。
在下文中一共展示了CCMenuItem::getZOrder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menuCallback
void MenuLayerMainMenu::menuCallback(CCObject* pSender)
{
CCLOG("menuCallback called");
// get the userdata, it's the index of the menu item clicked
CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);
int nIdx = pMenuItem->getZOrder() - 1000;
// create the test scene and run it
switch (nIdx)
{
case 1:
{
CCLOG("new game clicked");
CCScene* scene=CCScene::create();
CCLayer* layer=MenuLayerPlayerSelect::create();
scene->addChild(layer,0);
CCDirector::sharedDirector()->pushScene(CCTransitionSlideInT::create(1,scene));
break;
}
case 2:
CCLOG("load game clicked");
break;
case 6:
CCDirector::sharedDirector()->end();
default:
break;
}
}
示例2: menuCallback
void GameMenuLayer::menuCallback(CCObject* pSender)
{
CCMenuItem* menuItem = (CCMenuItem*)(pSender);
int nIdx = menuItem->getZOrder()-1000;
if (nIdx == GAME_MENU_START)
{
GameScene* pScene = new GameScene();
pScene->runThisTest();
pScene->release();
}
}
示例3: menuCallback
//--------------------------------------------------------
void CListControllerLayer::menuCallback(CCObject * pSender)
{
CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);
int nIdx = pMenuItem->getZOrder() - 10000;
// 创建并执行子场景
string szSceneClassName = GetSceneClassName(static_cast<ENUM_TEST_SCENE_TYPE>(nIdx));
if ( szSceneClassName != "" )
{
FKCOLORLOG( eConsolBKColor_Gray | eConsolTextColor_Red , "尝试创建 : %s", szSceneClassName.c_str() );
FKCW_SceneExMgr_SceneExMgr::sharedManager()->pushScene(LoadScene(szSceneClassName.c_str()));
}
}
示例4: menuCallback
void TitleScene::menuCallback(CCObject* pSender)
{
// get the userdata, it's the index of the menu item clicked
CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);
int nIdx = pMenuItem->getZOrder() - 10000;
CCLog("Index = %d", nIdx);
if (nIdx == ITEM_COUNT - 1)
{
// last item in the list is exit
CCDirector::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}
else
{
// create the scene and run it
CCScene *pScene = NULL;
switch (nIdx)
{
case 0:
pScene = GameScene::scene(); break;
case 1:
pScene = HelloWorld::scene(); break;
default:
break;
}
// run
if (pScene)
{
CCDirector::sharedDirector()->replaceScene(pScene);
}
}
}
示例5: menuCallback
void CocosDenshionTest::menuCallback(CCObject * pSender)
{
// get the userdata, it's the index of the menu item clicked
CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);
int nIdx = pMenuItem->getZOrder() - 10000;
switch(nIdx)
{
// play background music
case 0:
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(MUSIC_FILE)).c_str(), true);
break;
// stop background music
case 1:
SimpleAudioEngine::sharedEngine()->stopBackgroundMusic();
break;
// pause background music
case 2:
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
break;
// resume background music
case 3:
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
break;
// rewind background music
case 4:
SimpleAudioEngine::sharedEngine()->rewindBackgroundMusic();
break;
// is background music playing
case 5:
if (SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())
{
CCLOG("background music is playing");
}
else
{
CCLOG("background music is not playing");
}
break;
// play effect
case 6:
m_nSoundId = SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE)).c_str());
break;
// play effect
case 7:
m_nSoundId = SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE)).c_str(), true);
break;
// stop effect
case 8:
SimpleAudioEngine::sharedEngine()->stopEffect(m_nSoundId);
break;
// unload effect
case 9:
SimpleAudioEngine::sharedEngine()->unloadEffect(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE)).c_str());
break;
// add bakcground music volume
case 10:
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() + 0.1f);
break;
// sub backgroud music volume
case 11:
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() - 0.1f);
break;
// add effects volume
case 12:
SimpleAudioEngine::sharedEngine()->setEffectsVolume(SimpleAudioEngine::sharedEngine()->getEffectsVolume() + 0.1f);
break;
// sub effects volume
case 13:
SimpleAudioEngine::sharedEngine()->setEffectsVolume(SimpleAudioEngine::sharedEngine()->getEffectsVolume() - 0.1f);
break;
case 14:
SimpleAudioEngine::sharedEngine()->pauseEffect(m_nSoundId);
break;
case 15:
SimpleAudioEngine::sharedEngine()->resumeEffect(m_nSoundId);
break;
case 16:
SimpleAudioEngine::sharedEngine()->pauseAllEffects();
break;
case 17:
SimpleAudioEngine::sharedEngine()->resumeAllEffects();
break;
case 18:
SimpleAudioEngine::sharedEngine()->stopAllEffects();
break;
}
}
示例6: menuCallback
void TestLayer::menuCallback(CCObject * pSender)
{
CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);
this->testLogic(pMenuItem->getZOrder());
}
示例7: menuCallback
void SuDoKuLayer::menuCallback(CCObject* pSender) {
// 获得用户的数据,即菜单的索引
CCMenuItem* pMenuItem = (CCMenuItem *) (pSender);
int nIdx = pMenuItem->getZOrder();
CCLog("Zorder %d\n", nIdx);
}