android平台菜单返回键监听
//声明
void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event);
//实现
//按键控制(检测onKeyReleased有反应)auto listener =EventListenerKeyboard::create(); listener->onKeyReleased CC_CALLBACK_2MenuLayeronKeyReleasedthis); _eventDispatcheraddEventListenerWithSceneGraPHPriority(listener) {switchkeyCode //监听返回键caseKeyCodeKEY_ESCAPE:DirectorgetInstance()->endbreak; //监听menu键KEY_MENU}} 原文链接:/cocos2dx/340264.html