diff options
author | Johannes Schickel | 2013-10-20 22:27:50 +0200 |
---|---|---|
committer | Kamil Zbróg | 2013-10-24 12:59:16 +0100 |
commit | 2784901dac98f5972327a82bde147026cf7d7aee (patch) | |
tree | 06140c429b7510070332d0459cbc8c05adc143e6 /backends/graphics/openglsdl | |
parent | aebe01f7ecf2faf884a027f5dabf7989bfaae32a (diff) | |
download | scummvm-rg350-2784901dac98f5972327a82bde147026cf7d7aee.tar.gz scummvm-rg350-2784901dac98f5972327a82bde147026cf7d7aee.tar.bz2 scummvm-rg350-2784901dac98f5972327a82bde147026cf7d7aee.zip |
SDL: Clean up graphics manager switching slighty.
Sadly this also requires us to extend GraphicsManager for this SDL specific
feature. However, since that's only used in the SDL backend and Tizen it
should be fine for now...
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 17 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 5 |
2 files changed, 16 insertions, 6 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 925237b75e..088e97b1f7 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -82,15 +82,24 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt } OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() { +} + +void OpenGLSdlGraphicsManager::activateManager() { + OpenGLGraphicsManager::activateManager(); + initEventSource(); + + // Register the graphics manager as a event observer + g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false); +} + +void OpenGLSdlGraphicsManager::deactivateManager() { // Unregister the event observer if (g_system->getEventManager()->getEventDispatcher()) { g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this); } -} -void OpenGLSdlGraphicsManager::initEventObserver() { - // Register the graphics manager as a event observer - g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false); + deinitEventSource(); + OpenGLGraphicsManager::deactivateManager(); } bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) { diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index 0644f27602..9934ca79e2 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -35,9 +35,10 @@ public: OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource); virtual ~OpenGLSdlGraphicsManager(); - void initEventObserver(); - // GraphicsManager API + virtual void activateManager(); + virtual void deactivateManager(); + virtual bool hasFeature(OSystem::Feature f); virtual void setFeatureState(OSystem::Feature f, bool enable); virtual bool getFeatureState(OSystem::Feature f); |