aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl
diff options
context:
space:
mode:
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp49
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.h13
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();