mirror of https://github.com/axmolengine/axmol.git
Merge pull request #695 from GermanMtz/master
fixed #963: Member variable added to keep the current window active status
This commit is contained in:
commit
5c65af137b
|
@ -85,7 +85,8 @@ static CCEGLView* s_pInstance = NULL;
|
|||
CCEGLView::CCEGLView()
|
||||
: m_pDelegate(NULL),
|
||||
m_fScreenScaleFactor(1.0),
|
||||
m_bNotHVGA(false)
|
||||
m_bNotHVGA(false),
|
||||
m_isWindowActive(false)
|
||||
{
|
||||
s_pInstance = this;
|
||||
m_eglDisplay = EGL_NO_DISPLAY;
|
||||
|
@ -856,13 +857,43 @@ bool CCEGLView::HandleEvents()
|
|||
break;
|
||||
|
||||
case NAVIGATOR_WINDOW_INACTIVE:
|
||||
CCApplication::sharedApplication().applicationDidEnterBackground();
|
||||
if(m_isWindowActive)
|
||||
{
|
||||
CCApplication::sharedApplication().applicationDidEnterBackground();
|
||||
m_isWindowActive = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case NAVIGATOR_WINDOW_ACTIVE:
|
||||
CCApplication::sharedApplication().applicationWillEnterForeground();
|
||||
if(!m_isWindowActive)
|
||||
{
|
||||
CCApplication::sharedApplication().applicationWillEnterForeground();
|
||||
m_isWindowActive = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case NAVIGATOR_WINDOW_STATE:
|
||||
{
|
||||
switch(navigator_event_get_window_state(event))
|
||||
{
|
||||
case NAVIGATOR_WINDOW_FULLSCREEN:
|
||||
if(!m_isWindowActive)
|
||||
{
|
||||
CCApplication::sharedApplication().applicationWillEnterForeground();
|
||||
m_isWindowActive = true;
|
||||
}
|
||||
break;
|
||||
case NAVIGATOR_WINDOW_THUMBNAIL:
|
||||
if(m_isWindowActive)
|
||||
{
|
||||
CCApplication::sharedApplication().applicationDidEnterBackground();
|
||||
m_isWindowActive = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,8 @@ private:
|
|||
EGLTouchDelegate *m_pDelegate;
|
||||
float m_fScreenScaleFactor;
|
||||
|
||||
bool m_isWindowActive;
|
||||
|
||||
static bool m_initializedFunctions;
|
||||
static const GLubyte *m_extensions;
|
||||
|
||||
|
|
Loading…
Reference in New Issue