closed #3540, Solve the bug: Sometimes RenderTexture not drawn after a background/foreground.

This commit is contained in:
zhangbin 2014-02-20 14:43:07 +08:00
parent 43e51a9cb1
commit 9b2c5f71af
1 changed files with 6 additions and 4 deletions

View File

@ -585,14 +585,16 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd)
// The window is being hidden or closed, clean it up. // The window is being hidden or closed, clean it up.
engine_term_display(engine); engine_term_display(engine);
break; break;
case APP_CMD_GAINED_FOCUS: case APP_CMD_RESUME:
if (cocos2d::Director::getInstance()->getOpenGLView()) { if (cocos2d::Director::getInstance()->getOpenGLView()) {
cocos2d::Application::getInstance()->applicationWillEnterForeground(); cocos2d::Application::getInstance()->applicationWillEnterForeground();
engine->animating = 1; if (engine->display != nullptr)
{
engine->animating = 1;
}
} }
break; break;
case APP_CMD_LOST_FOCUS: case APP_CMD_PAUSE:
{ {
cocos2d::Application::getInstance()->applicationDidEnterBackground(); cocos2d::Application::getInstance()->applicationDidEnterBackground();
cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND); cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);