diff options
Diffstat (limited to 'src/client/joystick.cc')
-rw-r--r-- | src/client/joystick.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/client/joystick.cc b/src/client/joystick.cc index 0ea05a8..77d0b51 100644 --- a/src/client/joystick.cc +++ b/src/client/joystick.cc @@ -4,7 +4,7 @@ the terms and conditions of the GNU General Public License version 2 */ -#include "SDL/SDL.h" +#include "SDL2/SDL.h" #include "auxiliary/functions.h" #include "client/joystick.h" @@ -38,7 +38,7 @@ void Joystick::init() SDL_Joystick *joystick = SDL_JoystickOpen(i); if (joystick) { con_print << " joystick " << i + 1 << ": " << - SDL_JoystickName(i) << " " << + SDL_JoystickName(joystick) << " " << SDL_JoystickNumAxes(joystick) << " axes " << SDL_JoystickNumButtons(joystick) << " buttons " << std::endl; @@ -84,18 +84,14 @@ void Joystick::list() SDL_JoystickClose(current_joystick); current_joystick = 0; } - /* - // reset makes glorious segfaults - //SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - //SDL_InitSubSystem(SDL_INIT_JOYSTICK); - */ + int nbjoysticks = SDL_NumJoysticks(); if (nbjoysticks) { for (int i = 0; i < nbjoysticks; i++) { SDL_Joystick *joystick = SDL_JoystickOpen(i); if (joystick) { con_print << " joystick " << i + 1 << ": " << - SDL_JoystickName(i) << " " << + SDL_JoystickName(joystick) << " " << SDL_JoystickNumAxes(joystick) << " axes " << SDL_JoystickNumButtons(joystick) << " buttons " << std::endl; @@ -115,7 +111,7 @@ void Joystick::list() } if (current_joystick) { - con_debug << " using joystick " << SDL_JoystickName(current_joystick_number - 1) << std::endl; + con_debug << " using joystick " << SDL_JoystickName(current_joystick) << std::endl; SDL_JoystickEventState(SDL_ENABLE); } } @@ -145,7 +141,7 @@ void Joystick::frame() } if (current_joystick) { - con_debug << " using joystick " << SDL_JoystickName(current_joystick_number - 1) << std::endl; + con_debug << " using joystick " << SDL_JoystickName(current_joystick) << std::endl; SDL_JoystickEventState(SDL_ENABLE); } } |