mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
[Android] Removed dirty hack from Window.cpp
This commit is contained in:
parent
663dad18f2
commit
d6f98229a8
@ -29,6 +29,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/Event.hpp>
|
||||
#include <SFML/Window/Android/EglContext.hpp>
|
||||
#include <SFML/System/Mutex.hpp>
|
||||
#include <android/native_activity.h>
|
||||
#include <android/configuration.h>
|
||||
@ -54,6 +55,7 @@ struct ActivityStates
|
||||
ASensorEventQueue* sensorEventQueue;
|
||||
|
||||
EGLDisplay display;
|
||||
EglContext* context;
|
||||
|
||||
void* savedState;
|
||||
size_t savedStateSize;
|
||||
|
@ -87,6 +87,8 @@ m_surface (EGL_NO_SURFACE)
|
||||
ActivityStates* states = getActivity(NULL);
|
||||
sf::Lock lock(states->mutex);
|
||||
|
||||
states->context = this;
|
||||
|
||||
// Get the intialized EGL display
|
||||
m_display = states->display;
|
||||
|
||||
|
@ -41,15 +41,13 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplAndroid::WindowImplAndroid(WindowHandle handle) :
|
||||
m_context (NULL)
|
||||
WindowImplAndroid::WindowImplAndroid(WindowHandle handle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplAndroid::WindowImplAndroid(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings) :
|
||||
m_context (NULL)
|
||||
WindowImplAndroid::WindowImplAndroid(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings)
|
||||
{
|
||||
}
|
||||
|
||||
@ -93,12 +91,12 @@ void WindowImplAndroid::processEvents()
|
||||
}
|
||||
else if (tempEvent.type == Event::GainedFocus)
|
||||
{
|
||||
m_context->createSurface(states->window);
|
||||
states->context->createSurface(states->window);
|
||||
states->updated = true;
|
||||
}
|
||||
else if (tempEvent.type == Event::LostFocus)
|
||||
{
|
||||
m_context->destroySurface();
|
||||
states->context->destroySurface();
|
||||
states->updated = true;
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,6 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void setKeyRepeatEnabled(bool enabled);
|
||||
|
||||
EglContext* m_context;
|
||||
|
||||
protected :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -123,12 +123,6 @@ void Window::create(VideoMode mode, const String& title, Uint32 style, const Con
|
||||
// Recreate the context
|
||||
m_context = priv::GlContext::create(settings, m_impl, mode.bitsPerPixel);
|
||||
|
||||
#ifdef SFML_SYSTEM_ANDROID
|
||||
// On Android, the window needs its attached context to destroy/recreate
|
||||
// it when the native window is created/destroyed.
|
||||
static_cast<priv::WindowImplAndroid*>(m_impl)->m_context = (priv::EglContext*)m_context;
|
||||
#endif
|
||||
|
||||
// Perform common initializations
|
||||
initialize();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user