From 0630a88a04e9688d664751b6a68edf622d76b348 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 8 Aug 2011 23:46:05 +0200 Subject: 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. --- backends/graphics/gph/gph-graphics.cpp | 23 ++++++++++++++--------- backends/graphics/gph/gph-graphics.h | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'backends/graphics/gph') diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index 82a32203fb..12643fbff8 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -583,17 +583,22 @@ void GPHGraphicsManager::adjustMouseEvent(const Common::Event &event) { if (!event.synthetic) { Common::Event newEvent(event); newEvent.synthetic = true; - if (!_overlayVisible) { - if (_videoMode.mode == GFX_HALF) { - newEvent.mouse.x *= 2; - newEvent.mouse.y *= 2; - } - newEvent.mouse.x /= _videoMode.scaleFactor; - newEvent.mouse.y /= _videoMode.scaleFactor; - if (_videoMode.aspectRatioCorrection) - newEvent.mouse.y = aspect2Real(newEvent.mouse.y); + transformMouseCoordinates(newEvent.mouse); + g_system->getEventManager()->pushEvent(newEvent); + } +} + +void GPHGraphicsManager::transformMouseCoordinates(Common::Point &point) { + if (!_overlayVisible) { + if (_videoMode.mode == GFX_HALF) { + point.x *= 2; + point.y *= 2; } g_system->getEventManager()->pushEvent(newEvent); + point.x /= _videoMode.scaleFactor; + point.y /= _videoMode.scaleFactor; + if (_videoMode.aspectRatioCorrection) + point.y = aspect2Real(point.y); } } diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h index 45b8618569..f7d0ce43fd 100644 --- a/backends/graphics/gph/gph-graphics.h +++ b/backends/graphics/gph/gph-graphics.h @@ -57,6 +57,7 @@ public: SurfaceSdlGraphicsManager::VideoState *getVideoMode(); virtual void adjustMouseEvent(const Common::Event &event); + virtual void transformMouseCoordinates(Common::Point &point); }; #endif /* BACKENDS_GRAPHICS_GPH_H */ -- cgit v1.2.3