diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/sdl/sdl-common.cpp | 10 | ||||
-rw-r--r-- | backends/sdl/sdl-common.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp index 1bc2ec1416..32a885fecf 100644 --- a/backends/sdl/sdl-common.cpp +++ b/backends/sdl/sdl-common.cpp @@ -398,6 +398,16 @@ void OSystem_SDL_Common::set_mouse_pos(int x, int y) { undraw_mouse(); } } + +void OSystem_SDL_Common::warp_mouse(int x, int y) { + // FIXME: For whatever reason, I can't get CMI's cannon scene to work + // properly in fullscreen mode unless I temporarily show the mouse + // cursor here. + if (_full_screen) SDL_ShowCursor(SDL_ENABLE); + SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor); + if (_full_screen) SDL_ShowCursor(SDL_DISABLE); + set_mouse_pos(x, y); +} void OSystem_SDL_Common::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) { diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index 3cfbb2ecf4..b4e2b324db 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -52,6 +52,11 @@ public: // Set the position of the mouse cursor void set_mouse_pos(int x, int y); + + // Warp the mouse cursor. Where set_mouse_pos() only informs the + // backend of the mouse cursor's current position, this function + // actually moves the cursor to the specified position. + void warp_mouse(int x, int y); // Set the bitmap that's used when drawing the cursor. void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y); |