diff options
author | Johannes Schickel | 2011-08-08 23:46:05 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-08-09 00:03:11 +0200 |
commit | 0630a88a04e9688d664751b6a68edf622d76b348 (patch) | |
tree | 87d7867c298c60272eff69777b16bff5c15c8bfe /backends/graphics/openglsdl | |
parent | dedc74abfa44f7dac344da1868588193f91dd4f1 (diff) | |
download | scummvm-rg350-0630a88a04e9688d664751b6a68edf622d76b348.tar.gz scummvm-rg350-0630a88a04e9688d664751b6a68edf622d76b348.tar.bz2 scummvm-rg350-0630a88a04e9688d664751b6a68edf622d76b348.zip |
SDL: Let SDL based graphics managers inherit from SdlGraphicsManager.
This also adapts port I can not test (not even the compilation). So if this
breaks anything I am sorry about it.
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 49 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 13 |
2 files changed, 58 insertions, 4 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index bd7dd32e3b..8828cb5f49 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -30,8 +30,9 @@ #include "common/textconsole.h" #include "common/translation.h" -OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager() +OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(SdlEventSource *eventSource) : + SdlGraphicsManager(eventSource), _hwscreen(0), _screenResized(false), _activeFullscreenMode(-2), @@ -655,4 +656,50 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { return OpenGLGraphicsManager::notifyEvent(event); } +void OpenGLSdlGraphicsManager::notifyVideoExpose() { +} + +void OpenGLSdlGraphicsManager::notifyResize(const uint width, const uint height) { + // Do not resize if ignoring resize events. + if (!_ignoreResizeFrames && !getFullscreenMode()) { + bool scaleChanged = false; + beginGFXTransaction(); + _videoMode.hardwareWidth = width; + _videoMode.hardwareHeight = height; + + if (_videoMode.mode != OpenGL::GFX_ORIGINAL) { + _screenResized = true; + calculateDisplaySize(_videoMode.hardwareWidth, _videoMode.hardwareHeight); + } + + int scale = MIN(_videoMode.hardwareWidth / _videoMode.screenWidth, + _videoMode.hardwareHeight / _videoMode.screenHeight); + + if (getScale() != scale) { + scaleChanged = true; + setScale(MAX(MIN(scale, 3), 1)); + } + + if (_videoMode.mode == OpenGL::GFX_ORIGINAL) { + calculateDisplaySize(_videoMode.hardwareWidth, _videoMode.hardwareHeight); + } + + _transactionDetails.sizeChanged = true; + endGFXTransaction(); +#ifdef USE_OSD + if (scaleChanged) + displayScaleChangedMsg(); +#endif + } +} + +void OpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { + adjustMousePosition(point.x, point.y); +} + +void OpenGLSdlGraphicsManager::notifyMousePos(Common::Point mouse) { + _cursorState.x = mouse.x; + _cursorState.y = mouse.y; +} + #endif diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index ba9f94db2d..6cd255bbb8 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -23,19 +23,20 @@ #ifndef BACKENDS_GRAPHICS_OPENGLSDL_H #define BACKENDS_GRAPHICS_OPENGLSDL_H -#include "backends/platform/sdl/sdl-sys.h" #if defined(ARRAYSIZE) && !defined(_WINDOWS_) #undef ARRAYSIZE #endif +#include "backends/platform/sdl/sdl-sys.h" +#include "backends/graphics/sdl/sdl-graphics.h" #include "backends/graphics/opengl/opengl-graphics.h" /** * SDL OpenGL graphics manager */ -class OpenGLSdlGraphicsManager : public OpenGLGraphicsManager { +class OpenGLSdlGraphicsManager : public OpenGLGraphicsManager, public SdlGraphicsManager { public: - OpenGLSdlGraphicsManager(); + OpenGLSdlGraphicsManager(SdlEventSource *eventSource); virtual ~OpenGLSdlGraphicsManager(); virtual bool hasFeature(OSystem::Feature f); @@ -49,6 +50,12 @@ public: virtual void updateScreen(); + // SdlGraphicsManager interface + virtual void notifyVideoExpose(); + virtual void notifyResize(const uint width, const uint height); + virtual void transformMouseCoordinates(Common::Point &point); + virtual void notifyMousePos(Common::Point mouse); + protected: virtual void internUpdateScreen(); |