aboutsummaryrefslogtreecommitdiff
path: root/backends/events/sdl/sdl-events.h
diff options
context:
space:
mode:
authorBastien Bouclet2017-12-10 10:50:08 +0100
committerBastien Bouclet2017-12-26 21:11:04 +0100
commitac78058fcdf5d0e98522edf837ce250130e45eaa (patch)
tree8d176e07669e7c28d7a1b8d5ac1ade205b91b5d4 /backends/events/sdl/sdl-events.h
parent9cb2e4357715873f192d40ddd7570116cde98d25 (diff)
downloadscummvm-rg350-ac78058fcdf5d0e98522edf837ce250130e45eaa.tar.gz
scummvm-rg350-ac78058fcdf5d0e98522edf837ce250130e45eaa.tar.bz2
scummvm-rg350-ac78058fcdf5d0e98522edf837ce250130e45eaa.zip
SDL: Initial support for game controllers
The button mapping is that of the Vita port Co-Authored-By: rsn8887 <rsn8887@users.noreply.github.com>
Diffstat (limited to 'backends/events/sdl/sdl-events.h')
-rw-r--r--backends/events/sdl/sdl-events.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index 5fd3cb7ea5..cea944fb1a 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -80,6 +80,11 @@ protected:
/** Joystick */
SDL_Joystick *_joystick;
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ /** Game controller */
+ SDL_GameController *_controller;
+#endif
+
/** Last screen id for checking if it was modified */
int _lastScreenID;
@@ -117,9 +122,19 @@ protected:
virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
virtual bool handleKbdMouse(Common::Event &event);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ virtual bool handleControllerButton(const SDL_Event &ev, Common::Event &event, bool buttonUp);
+ virtual bool handleControllerAxisMotion(const SDL_Event &ev, Common::Event &event);
+#endif
+
//@}
/**
+ * Update the virtual mouse according to a joystick or game controller axis position change
+ */
+ bool handleAxisToMouseMotion(int16 xAxis, int16 yAxis);
+
+ /**
* Assigns the mouse coords to the mouse event. Furthermore notify the
* graphics manager about the position change.
*/