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()
|
CCEGLView::CCEGLView()
|
||||||
: m_pDelegate(NULL),
|
: m_pDelegate(NULL),
|
||||||
m_fScreenScaleFactor(1.0),
|
m_fScreenScaleFactor(1.0),
|
||||||
m_bNotHVGA(false)
|
m_bNotHVGA(false),
|
||||||
|
m_isWindowActive(false)
|
||||||
{
|
{
|
||||||
s_pInstance = this;
|
s_pInstance = this;
|
||||||
m_eglDisplay = EGL_NO_DISPLAY;
|
m_eglDisplay = EGL_NO_DISPLAY;
|
||||||
|
@ -856,13 +857,43 @@ bool CCEGLView::HandleEvents()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAVIGATOR_WINDOW_INACTIVE:
|
case NAVIGATOR_WINDOW_INACTIVE:
|
||||||
|
if(m_isWindowActive)
|
||||||
|
{
|
||||||
CCApplication::sharedApplication().applicationDidEnterBackground();
|
CCApplication::sharedApplication().applicationDidEnterBackground();
|
||||||
|
m_isWindowActive = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAVIGATOR_WINDOW_ACTIVE:
|
case NAVIGATOR_WINDOW_ACTIVE:
|
||||||
|
if(!m_isWindowActive)
|
||||||
|
{
|
||||||
CCApplication::sharedApplication().applicationWillEnterForeground();
|
CCApplication::sharedApplication().applicationWillEnterForeground();
|
||||||
|
m_isWindowActive = true;
|
||||||
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,8 @@ private:
|
||||||
EGLTouchDelegate *m_pDelegate;
|
EGLTouchDelegate *m_pDelegate;
|
||||||
float m_fScreenScaleFactor;
|
float m_fScreenScaleFactor;
|
||||||
|
|
||||||
|
bool m_isWindowActive;
|
||||||
|
|
||||||
static bool m_initializedFunctions;
|
static bool m_initializedFunctions;
|
||||||
static const GLubyte *m_extensions;
|
static const GLubyte *m_extensions;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue