mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fixed WindowImplAndroid used after deleted.
This commit is contained in:
parent
f3a180bc09
commit
20c23f0007
@ -84,6 +84,7 @@ WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& title, unsign
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplAndroid::~WindowImplAndroid()
|
WindowImplAndroid::~WindowImplAndroid()
|
||||||
{
|
{
|
||||||
|
WindowImplAndroid::singleInstance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -216,22 +217,25 @@ bool WindowImplAndroid::hasFocus() const
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::forwardEvent(const Event& event)
|
void WindowImplAndroid::forwardEvent(const Event& event)
|
||||||
{
|
{
|
||||||
ActivityStates* states = getActivity(NULL);
|
if (WindowImplAndroid::singleInstance != NULL)
|
||||||
|
|
||||||
if (event.type == Event::GainedFocus)
|
|
||||||
{
|
{
|
||||||
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window);
|
ActivityStates* states = getActivity(NULL);
|
||||||
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window);
|
|
||||||
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
|
|
||||||
WindowImplAndroid::singleInstance->m_hasFocus = true;
|
|
||||||
}
|
|
||||||
else if (event.type == Event::LostFocus)
|
|
||||||
{
|
|
||||||
WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true;
|
|
||||||
WindowImplAndroid::singleInstance->m_hasFocus = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowImplAndroid::singleInstance->pushEvent(event);
|
if (event.type == Event::GainedFocus)
|
||||||
|
{
|
||||||
|
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window);
|
||||||
|
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window);
|
||||||
|
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
|
||||||
|
WindowImplAndroid::singleInstance->m_hasFocus = true;
|
||||||
|
}
|
||||||
|
else if (event.type == Event::LostFocus)
|
||||||
|
{
|
||||||
|
WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true;
|
||||||
|
WindowImplAndroid::singleInstance->m_hasFocus = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowImplAndroid::singleInstance->pushEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user