33 SDL_InitSubSystem(SDL_INIT_JOYSTICK);
36 SDL_JoystickEventState(SDL_ENABLE);
41 Log::info(
"- %s", SDL_JoystickNameForIndex(i));
46 , mUpTolerance(
config.upTolerance)
47 , mDownTolerance(
config.downTolerance)
48 , mLeftTolerance(
config.leftTolerance)
49 , mRightTolerance(
config.rightTolerance)
51 , mEnabled(
config.joystickEnabled)
60 Log::info(
"Couldn't open joystick: %s", SDL_GetError());
90 int position = SDL_JoystickGetAxis(
mJoystick, 0);
97 position = SDL_JoystickGetAxis(
mJoystick, 1);
120 int position = SDL_JoystickGetAxis(
mJoystick, 0);
127 position = SDL_JoystickGetAxis(
mJoystick, 1);
static void init()
Initializes the joystick subsystem.
void update()
Updates the direction and button information.
bool mButtons[MAX_BUTTONS]
Joystick(int no)
Constructor, pass the number of the joystick the new object should access.
bool buttonPressed(unsigned char no) const
Config config
Global settings (config.xml)
void info(const char *log_text,...) LOG_PRINTF_ATTR