mirror of https://github.com/axmolengine/axmol.git
Member variable added to keep the current window active status
This commit is contained in:
parent
acdd00f03b
commit
c78bf39601
|
@ -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;
|
||||||
|
@ -844,7 +845,6 @@ bool CCEGLView::HandleEvents()
|
||||||
|
|
||||||
if (domain == navigator_get_domain())
|
if (domain == navigator_get_domain())
|
||||||
{
|
{
|
||||||
const bool isPaused = CCDirector::sharedDirector()->isPaused();
|
|
||||||
switch (bps_event_get_code(event))
|
switch (bps_event_get_code(event))
|
||||||
{
|
{
|
||||||
case NAVIGATOR_SWIPE_DOWN:
|
case NAVIGATOR_SWIPE_DOWN:
|
||||||
|
@ -857,13 +857,19 @@ bool CCEGLView::HandleEvents()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAVIGATOR_WINDOW_INACTIVE:
|
case NAVIGATOR_WINDOW_INACTIVE:
|
||||||
if(!isPaused)
|
if(m_isWindowActive)
|
||||||
|
{
|
||||||
CCApplication::sharedApplication().applicationDidEnterBackground();
|
CCApplication::sharedApplication().applicationDidEnterBackground();
|
||||||
|
m_isWindowActive = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAVIGATOR_WINDOW_ACTIVE:
|
case NAVIGATOR_WINDOW_ACTIVE:
|
||||||
if(isPaused)
|
if(!m_isWindowActive)
|
||||||
|
{
|
||||||
CCApplication::sharedApplication().applicationWillEnterForeground();
|
CCApplication::sharedApplication().applicationWillEnterForeground();
|
||||||
|
m_isWindowActive = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAVIGATOR_WINDOW_STATE:
|
case NAVIGATOR_WINDOW_STATE:
|
||||||
|
@ -871,12 +877,18 @@ bool CCEGLView::HandleEvents()
|
||||||
switch(navigator_event_get_window_state(event))
|
switch(navigator_event_get_window_state(event))
|
||||||
{
|
{
|
||||||
case NAVIGATOR_WINDOW_FULLSCREEN:
|
case NAVIGATOR_WINDOW_FULLSCREEN:
|
||||||
if(isPaused)
|
if(!m_isWindowActive)
|
||||||
|
{
|
||||||
CCApplication::sharedApplication().applicationWillEnterForeground();
|
CCApplication::sharedApplication().applicationWillEnterForeground();
|
||||||
|
m_isWindowActive = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NAVIGATOR_WINDOW_THUMBNAIL:
|
case NAVIGATOR_WINDOW_THUMBNAIL:
|
||||||
if(!isPaused)
|
if(m_isWindowActive)
|
||||||
|
{
|
||||||
CCApplication::sharedApplication().applicationDidEnterBackground();
|
CCApplication::sharedApplication().applicationDidEnterBackground();
|
||||||
|
m_isWindowActive = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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