aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2009-11-10 19:51:40 +0000
committerPaweł Kołodziejski2009-11-10 19:51:40 +0000
commitc25739b839c51d7116db1c5e454e5b6148a46786 (patch)
tree2873f592aef17980c821a7cf1c61619d0ad38356
parent92bd012b55a2918c43b16026ad9c87f5b5852757 (diff)
downloadscummvm-rg350-c25739b839c51d7116db1c5e454e5b6148a46786.tar.gz
scummvm-rg350-c25739b839c51d7116db1c5e454e5b6148a46786.tar.bz2
scummvm-rg350-c25739b839c51d7116db1c5e454e5b6148a46786.zip
properly fixed mouse positioning in game engine
svn-id: r45810
-rw-r--r--backends/platform/samsungtv/events.cpp11
-rw-r--r--backends/platform/samsungtv/graphics.cpp13
-rw-r--r--backends/platform/samsungtv/sdl.h1
3 files changed, 23 insertions, 2 deletions
diff --git a/backends/platform/samsungtv/events.cpp b/backends/platform/samsungtv/events.cpp
index 1363fa3f19..3b19b41c8e 100644
--- a/backends/platform/samsungtv/events.cpp
+++ b/backends/platform/samsungtv/events.cpp
@@ -29,6 +29,15 @@
#if defined(SAMSUNGTV)
+void OSystem_SDL_SamsungTV::generateMouseMoveEvent(int x, int y) {
+ SDL_Event event;
+ memset(&event, 0, sizeof(event));
+ event.type = SDL_MOUSEMOTION;
+ event.motion.x = x;
+ event.motion.y = y;
+ SDL_PushEvent(&event);
+}
+
void OSystem_SDL_SamsungTV::handleKbdMouse() {
uint32 curTime = getMillis();
if (curTime >= _km.last_time + _km.delay_time) {
@@ -93,7 +102,7 @@ void OSystem_SDL_SamsungTV::handleKbdMouse() {
_km.y_down_count = 1;
}
- setMousePos(_km.x, _km.y);
+ generateMouseMoveEvent(_km.x, _km.y);
}
}
}
diff --git a/backends/platform/samsungtv/graphics.cpp b/backends/platform/samsungtv/graphics.cpp
index 79267b8628..8a08f8a28e 100644
--- a/backends/platform/samsungtv/graphics.cpp
+++ b/backends/platform/samsungtv/graphics.cpp
@@ -542,8 +542,19 @@ void OSystem_SDL_SamsungTV::setFullscreenMode(bool enable) {
}
void OSystem_SDL_SamsungTV::warpMouse(int x, int y) {
- if (_mouseCurState.x != x || _mouseCurState.y != y)
+ int y1 = y;
+
+ if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+ y1 = real2Aspect(y);
+
+ if (_mouseCurState.x != x || _mouseCurState.y != y) {
+ if (!_overlayVisible)
+ generateMouseMoveEvent(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor);
+ else
+ generateMouseMoveEvent(x, y1);
+
setMousePos(x, y);
+ }
}
void OSystem_SDL_SamsungTV::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
diff --git a/backends/platform/samsungtv/sdl.h b/backends/platform/samsungtv/sdl.h
index c08cdca69a..aebf7296c7 100644
--- a/backends/platform/samsungtv/sdl.h
+++ b/backends/platform/samsungtv/sdl.h
@@ -96,6 +96,7 @@ protected:
void setFullscreenMode(bool enable);
void handleKbdMouse();
+ void generateMouseMoveEvent(int x, int y);
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
};