diff options
author | Max Horn | 2010-11-28 14:57:59 +0000 |
---|---|---|
committer | Max Horn | 2010-11-28 14:57:59 +0000 |
commit | d5840b72f9535e303d340cb8f5f164ddb6fc27ee (patch) | |
tree | 70b002148eced2d94e20bdbe7926bde5817cd60d | |
parent | 0b5f6d4c979028b78c3b6c33f371b46b31cd0c9b (diff) | |
download | scummvm-rg350-d5840b72f9535e303d340cb8f5f164ddb6fc27ee.tar.gz scummvm-rg350-d5840b72f9535e303d340cb8f5f164ddb6fc27ee.tar.bz2 scummvm-rg350-d5840b72f9535e303d340cb8f5f164ddb6fc27ee.zip |
DINGUX: Attempt to fix the new code for this backend
It seems in the gsoc2010-opengl branch, the dingux port was not anymore
updated at some point, so some changes that were made in general did not
make it till here. This is my attempt to fix at least the most obvious
problems, but without being able to compile it, all these changes should
be very carefully reviewed.
svn-id: r54522
-rw-r--r-- | backends/events/dinguxsdl/dinguxsdl-events.cpp | 46 | ||||
-rw-r--r-- | backends/events/dinguxsdl/dinguxsdl-events.h | 11 | ||||
-rw-r--r-- | backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp | 28 | ||||
-rw-r--r-- | backends/graphics/dinguxsdl/dinguxsdl-graphics.h | 4 | ||||
-rw-r--r-- | backends/platform/dingux/dingux.cpp | 1 |
5 files changed, 32 insertions, 58 deletions
diff --git a/backends/events/dinguxsdl/dinguxsdl-events.cpp b/backends/events/dinguxsdl/dinguxsdl-events.cpp index 1eed96acfe..017b46189d 100644 --- a/backends/events/dinguxsdl/dinguxsdl-events.cpp +++ b/backends/events/dinguxsdl/dinguxsdl-events.cpp @@ -26,7 +26,6 @@ #if defined(DINGUX) #include "backends/events/dinguxsdl/dinguxsdl-events.h" -#include "graphics/scaler/aspect.h" // for aspect2Real #define PAD_UP SDLK_UP #define PAD_DOWN SDLK_DOWN @@ -58,10 +57,6 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) { return key; } -DINGUXSdlEventSource::DINGUXSdlEventSource() : SdlEventSource() { - ; -} - bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) { if (ev.key.keysym.sym == PAD_UP) { if (ev.type == SDL_KEYDOWN) { @@ -182,45 +177,4 @@ bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) { return false; } -void DINGUXSdlEventSource::fillMouseEvent(Common::Event &event, int x, int y) { - if (_grpMan->getVideoMode()->mode == GFX_HALF && !(_grpMan->isOverlayVisible())) { - event.mouse.x = x * 2; - event.mouse.y = y * 2; - } else { - event.mouse.x = x; - event.mouse.y = y; - } - - // Update the "keyboard mouse" coords - _km.x = x; - _km.y = y; - - // Adjust for the screen scaling - if (!(_grpMan->isOverlayVisible())) { - event.mouse.x /= (_grpMan->getVideoMode())->scaleFactor; - event.mouse.y /= (_grpMan->getVideoMode())->scaleFactor; -#if 0 - if (_grpMan->getVideoMode()->aspectRatioCorrection) - event.mouse.y = aspect2Real(event.mouse.y); -#endif - } -} - -void DINGUXSdlEventSource::warpMouse(int x, int y) { - int mouse_cur_x = _grpMan->getMouseCurState()->x; - int mouse_cur_y = _grpMan->getMouseCurState()->y; - - if ((mouse_cur_x != x) || (mouse_cur_y != y)) { - if (_grpMan->getVideoMode()->mode == GFX_HALF && !(_grpMan->isOverlayVisible())) { - x = x / 2; - y = y / 2; - } - } - SDL_WarpMouse(x, y); -} - -void DINGUXSdlEventSource::setCurrentGraphMan(DINGUXSdlGraphicsManager *_graphicManager) { - _grpMan = _graphicManager; -} - #endif /* DINGUX */ diff --git a/backends/events/dinguxsdl/dinguxsdl-events.h b/backends/events/dinguxsdl/dinguxsdl-events.h index f269fcf358..87814437e0 100644 --- a/backends/events/dinguxsdl/dinguxsdl-events.h +++ b/backends/events/dinguxsdl/dinguxsdl-events.h @@ -27,20 +27,11 @@ #define BACKENDS_EVENTS_SDL_DINGUX_H #if defined(DINGUX) -#include "backends/platform/dingux/dingux.h" -#include "backends/events/dinguxsdl/dinguxsdl-events.h" +#include "backends/events/sdl/sdl-events.h" class DINGUXSdlEventSource : public SdlEventSource { -public: - DINGUXSdlEventSource(); - void setCurrentGraphMan(DINGUXSdlGraphicsManager *_graphicManager); - protected: - DINGUXSdlGraphicsManager *_grpMan; - bool remapKey(SDL_Event &ev, Common::Event &event); - void fillMouseEvent(Common::Event &event, int x, int y); - void warpMouse(int x, int y); }; #endif /* DINGUX */ diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index c38d53e86b..f92f71b1c1 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -503,4 +503,32 @@ bool DINGUXSdlGraphicsManager::isOverlayVisible() { return _overlayVisible; } +void DINGUXSdlGraphicsManager::warpMouse(int x, int y) { + if (_mouseCurState.x != x || _mouseCurState.y != y) { + if (_videoMode.mode == GFX_HALF && !_overlayVisible) { + x = x / 2; + y = y / 2; + } + } + SdlGraphicsManager::warpMouse(x, y); +} + +void DINGUXSdlGraphicsManager::adjustMouseEvent(const Common::Event &event) { + if (!event.synthetic) { + Common::Event newEvent(event); + newEvent.synthetic = true; + if (!_overlayVisible) { + if (_videoMode.mode == GFX_HALF) { + event.mouse.x *= 2; + event.mouse.y *= 2; + } + newEvent.mouse.x /= _videoMode.scaleFactor; + newEvent.mouse.y /= _videoMode.scaleFactor; + if (_videoMode.aspectRatioCorrection) + newEvent.mouse.y = aspect2Real(newEvent.mouse.y); + } + g_system->getEventManager()->pushEvent(newEvent); + } +} + #endif diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h index b2edd73f6d..9668f45166 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h @@ -56,10 +56,12 @@ public: bool loadGFXMode(); void drawMouse(); void undrawMouse(); + virtual void warpMouse(int x, int y); SdlGraphicsManager::MousePos *getMouseCurState(); SdlGraphicsManager::VideoState *getVideoMode(); - bool isOverlayVisible(); + + virtual void adjustMouseEvent(const Common::Event &event); protected: SdlEventSource *_evSrc; diff --git a/backends/platform/dingux/dingux.cpp b/backends/platform/dingux/dingux.cpp index e982934fb7..89a403d5ae 100644 --- a/backends/platform/dingux/dingux.cpp +++ b/backends/platform/dingux/dingux.cpp @@ -37,7 +37,6 @@ void OSystem_SDL_Dingux::initBackend() { // Create the graphics manager if (_graphicsManager == 0) { _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource); - ((DINGUXSdlEventSource*)_eventSource)->setCurrentGraphMan((DINGUXSdlGraphicsManager*)_graphicsManager); } // Call parent implementation of this method |