From ac78058fcdf5d0e98522edf837ce250130e45eaa Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 10 Dec 2017 10:50:08 +0100 Subject: SDL: Initial support for game controllers The button mapping is that of the Vita port Co-Authored-By: rsn8887 --- backends/events/sdl/sdl-events.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'backends/events/sdl/sdl-events.h') 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,8 +122,18 @@ 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. -- cgit v1.2.3