diff options
Diffstat (limited to 'src/input/joystick.h')
-rw-r--r-- | src/input/joystick.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/input/joystick.h b/src/input/joystick.h index 293e75a22..2a7e0f638 100644 --- a/src/input/joystick.h +++ b/src/input/joystick.h @@ -51,8 +51,15 @@ class Joystick final MAX_BUTTONS = 64 }; + enum + { + RESERVED_AXES = 2, // reserved for movement + MAX_AXES = 8 // number of axes we can handle + }; + /** - * Additional "buttons" for hat 0 (d-pad). + * Additional "buttons" for hat 0 (d-pad), + * sticks and triggers. */ enum { @@ -60,7 +67,9 @@ class Joystick final KEY_DOWN, KEY_LEFT, KEY_RIGHT, - KEY_LAST = KEY_RIGHT + KEY_NEGATIVE_AXIS_FIRST, + KEY_POSITIVE_AXIS_FIRST = KEY_NEGATIVE_AXIS_FIRST + MAX_AXES, + KEY_END = KEY_POSITIVE_AXIS_FIRST + MAX_AXES }; /** @@ -169,12 +178,14 @@ class Joystick final unsigned char mDirection; unsigned char mHatPosition; + int mAxesPositions[MAX_AXES]; bool mActiveButtons[MAX_BUTTONS]; SDL_Joystick *mJoystick; float mTolerance; int mNumber; + int mAxesNumber; int mButtonsNumber; bool mUseHatForMovement; bool mUseInactive; |