From 83b199e9212092bcc737e36eb3f0cff0666ddeac Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 17 Mar 2011 20:27:00 +0100 Subject: OPENGL: Move setFullscreenMode to OpenGLGraphicsManager. --- backends/graphics/opengl/opengl-graphics.cpp | 21 +++++++++++++++++++++ backends/graphics/opengl/opengl-graphics.h | 5 +++++ backends/graphics/openglsdl/openglsdl-graphics.cpp | 13 ------------- backends/graphics/openglsdl/openglsdl-graphics.h | 3 --- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 915a686285..0729ff331c 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -98,6 +98,10 @@ bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) { void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { switch (f) { + case OSystem::kFeatureFullscreenMode: + setFullscreenMode(enable); + break; + case OSystem::kFeatureAspectRatioCorrection: // TODO: If we enable aspect ratio correction, we automatically set // the video mode to 4/3. That is quity messy, but since we have that @@ -108,6 +112,7 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { if (enable) _videoMode.mode = OpenGL::GFX_4_3; break; + default: break; } @@ -115,8 +120,12 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) { switch (f) { + case OSystem::kFeatureFullscreenMode: + return _videoMode.fullscreen; + case OSystem::kFeatureAspectRatioCorrection: return _videoMode.mode == OpenGL::GFX_4_3; + default: return false; } @@ -677,6 +686,18 @@ void OpenGLGraphicsManager::displayMessageOnOSD(const char *msg) { // Intern // +void OpenGLGraphicsManager::setFullscreenMode(bool enable) { + assert(_transactionMode == kTransactionActive); + + if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable) + return; + + if (_transactionMode == kTransactionActive) { + _videoMode.fullscreen = enable; + _transactionDetails.needRefresh = true; + } +} + void OpenGLGraphicsManager::refreshGameScreen() { if (_screenNeedsRedraw) _screenDirtyRect = Common::Rect(0, 0, _screenData.w, _screenData.h); diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 31606cf336..c8b64fab89 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -175,6 +175,11 @@ protected: virtual bool loadGFXMode(); virtual void unloadGFXMode(); + /** + * Setup the fullscreen mode state. + */ + void setFullscreenMode(bool enable); + /** * Set the scale factor. * diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 3eb15bd684..e16a51762c 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -79,9 +79,6 @@ bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) { void OpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { switch (f) { - case OSystem::kFeatureFullscreenMode: - setFullscreenMode(enable); - break; case OSystem::kFeatureIconifyWindow: if (enable) SDL_WM_IconifyWindow(); @@ -422,16 +419,6 @@ void OpenGLSdlGraphicsManager::displayScaleChangedMsg() { } #endif -void OpenGLSdlGraphicsManager::setFullscreenMode(bool enable) { - if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable) - return; - - if (_transactionMode == kTransactionActive) { - _videoMode.fullscreen = enable; - _transactionDetails.needRefresh = true; - } -} - bool OpenGLSdlGraphicsManager::isHotkey(const Common::Event &event) { if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { if (event.kbd.keycode == Common::KEYCODE_PLUS || event.kbd.keycode == Common::KEYCODE_MINUS || diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index f706fc2bf5..e9e5ed882d 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -57,9 +57,6 @@ protected: virtual bool loadGFXMode(); virtual void unloadGFXMode(); - - virtual void setFullscreenMode(bool enable); - virtual bool isHotkey(const Common::Event &event); #ifdef USE_RGB_COLOR -- cgit v1.2.3