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


C++ CCMenuItem::getZOrder方法代码示例

本文整理汇总了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;
	}
}
开发者ID:yxf006,项目名称:coco-project,代码行数:34,代码来源:MenuLayerMainMenu.cpp

示例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();
	}
}
开发者ID:pigling,项目名称:Breakout_BB10,代码行数:12,代码来源:GameMenuScene.cpp

示例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()));
	}
}
开发者ID:duzhi5368,项目名称:FKCocos2dxWrapper_2.x,代码行数:14,代码来源:ListControllerLayer.cpp

示例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);
        }
    }
    
}
开发者ID:akinlin,项目名称:ProjectDrumroll,代码行数:39,代码来源:TitleScene.cpp

示例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;
    }
    
}
开发者ID:csdnnet,项目名称:hiygame,代码行数:90,代码来源:CocosDenshionTest.cpp

示例6: menuCallback

void TestLayer::menuCallback(CCObject * pSender)
{
    CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);
    this->testLogic(pMenuItem->getZOrder());
}
开发者ID:bzh1113,项目名称:SpiderMonkeyMix-Cocos2dx,代码行数:5,代码来源:TestLayer.cpp

示例7: menuCallback

void SuDoKuLayer::menuCallback(CCObject* pSender) {
	// 获得用户的数据,即菜单的索引
	CCMenuItem* pMenuItem = (CCMenuItem *) (pSender);
	int nIdx = pMenuItem->getZOrder();
	CCLog("Zorder %d\n", nIdx);
}
开发者ID:DangoXJ,项目名称:SuDoKu,代码行数:6,代码来源:SuDoKuLayer.cpp


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