1.在layer中调用:
layer中重写以下两个方法:
?
- virtualvoidkeyBackClicked();//响应返回键
- virtualvoidkeyMenuClicked();//响应Menu键
- voidCBaseLayer::keyBackClicked(){
- intiManSceneTag=CCDirector::sharedDirector()->getRunningScene()->getTag();//如果是主场景,则退出
- if(MAIN_SCENE_TAG==iManSceneTag){
- CCDirector::sharedDirector()->end();
- #if(CC_TARGET_PLATFORM==CC_PLATFORM_IOS)
- exit(0);
- #endif
- }
- }
- voidCBaseLayer::keyMenuClicked(){
- }