开启按键按键监听
setKeypadEnabled(true);
重写监听事件函数
virtual void keyBackClicked();
如:
void BanQiuLayer::keyBackClicked() { //暂停声音播放 CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); mag->toBeginLayer(); //返回到上一个场景 }
开启按键按键监听
setKeypadEnabled(true);
virtual void keyBackClicked();
void BanQiuLayer::keyBackClicked() { //暂停声音播放 CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); mag->toBeginLayer(); //返回到上一个场景 }