Skip to content

Instantly share code, notes, and snippets.

View kyokomi's full-sized avatar
🙃
ぬるぽ

kyokomi kyokomi

🙃
ぬるぽ
View GitHub Profile
@kyokomi
kyokomi / AppDelegate.cpp
Created March 15, 2014 09:26
EventDispatherについての調査資料1
// 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();
@kyokomi
kyokomi / AppDelegate.cpp
Last active August 29, 2015 13:57
EventDispatherについての調査資料2
// 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);
@kyokomi
kyokomi / RogueScene.Scene以外にもEventListenerを設定してみる.md
Last active August 29, 2015 13:57
EventDispatherについての調査資料3
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();
 });