Skip to content

Commit

Permalink
fix there is no EVENT_COME_TO_BACKGROUND and EVENT_COME_TO_FOREGROUND…
Browse files Browse the repository at this point in the history
… event dispatch on android platform;
  • Loading branch information
xuxiaocheng committed Jul 24, 2014
1 parent e5fa220 commit 35c8361
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "CCIMEDispatcher.h"
#include "CCDirector.h"
#include "CCEventType.h"
#include "CCEventCustom.h"
#include "../CCApplication.h"
#include "platform/CCFileUtils.h"
#include "CCEventType.h"
Expand All @@ -16,11 +18,15 @@ extern "C" {

JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause() {
Application::getInstance()->applicationDidEnterBackground();
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
}

JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume() {
if (Director::getInstance()->getOpenGLView()) {
Application::getInstance()->applicationWillEnterForeground();
cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent);
}
}

Expand Down

0 comments on commit 35c8361

Please sign in to comment.