[Android] Removed dirty hack from Window.cpp

This commit is contained in:
Jonathan De Wachter 2013-10-18 11:31:35 +02:00
parent 663dad18f2
commit d6f98229a8
5 changed files with 8 additions and 14 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -151,8 +151,6 @@ public :
////////////////////////////////////////////////////////////
virtual void setKeyRepeatEnabled(bool enabled);
EglContext* m_context;
protected :
////////////////////////////////////////////////////////////

View File

@ -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();
}