bool RogueScene::init() {
... 省略 ...
auto foreground_player_listener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND_ROGUE, [actorSprite](EventCustom* event){
CCLOG("event! EVENT_COME_TO_FOREGROUND_ROGUE actorSprite");
// 左向け左!
actorSprite->runLeftAction();
});
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function will be called when the app is active again | |
void AppDelegate::applicationWillEnterForeground() { | |
Director::getInstance()->startAnimation(); | |
// if you use SimpleAudioEngine, it must resume here | |
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); | |
CCLOG("バックグラウンドから復活しました!!"); | |
auto base_scene = Director::getInstance()->getRunningScene(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too | |
void AppDelegate::applicationWillEnterForeground() { | |
Director::getInstance()->stopAnimation(); | |
// if you use SimpleAudioEngine, it must be pause | |
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); | |
// フォアグラウンド時のイベントを発行 | |
cocos2d::EventCustom foreground_event_rgoue(EVENT_COME_TO_FOREGROUND_ROGUE); | |
Director::getInstance()->getEventDispatcher()->dispatchEvent(&foreground_event_rgoue); |
NewerOlder