diff options
author | ewewukek <ewewukek@gmail.com> | 2024-01-11 12:53:19 +0300 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2024-05-15 00:11:33 +0200 |
commit | a9b4edd10420fb35679ee9aac3caa9eb8f35e6dd (patch) | |
tree | 9cb3630b5514bda7c3cc83f2a1e6276e34b948b8 /src/input/joystick.h | |
parent | 84a11a02aad86d9388175c7fd0971accdb586473 (diff) | |
download | mv-a9b4edd10420fb35679ee9aac3caa9eb8f35e6dd.tar.gz mv-a9b4edd10420fb35679ee9aac3caa9eb8f35e6dd.tar.bz2 mv-a9b4edd10420fb35679ee9aac3caa9eb8f35e6dd.tar.xz mv-a9b4edd10420fb35679ee9aac3caa9eb8f35e6dd.zip |
Make D-Pad behave like regular buttons
Diffstat (limited to 'src/input/joystick.h')
-rw-r--r-- | src/input/joystick.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/input/joystick.h b/src/input/joystick.h index 32fdddf2e..bddf520a2 100644 --- a/src/input/joystick.h +++ b/src/input/joystick.h @@ -52,6 +52,18 @@ class Joystick final }; /** + * Additional "buttons" for hat 0 (d-pad). + */ + enum + { + KEY_UP = MAX_BUTTONS, + KEY_DOWN, + KEY_LEFT, + KEY_RIGHT, + KEY_LAST = KEY_RIGHT + }; + + /** * Directions, to be used as bitmask values. */ enum @@ -107,7 +119,7 @@ class Joystick final */ void logic(); - bool buttonPressed(const unsigned char no) const A_WARN_UNUSED; + bool buttonPressed(const int no) const A_WARN_UNUSED; bool isUp() const noexcept2 A_WARN_UNUSED { return mEnabled && ((mDirection & UP) != 0); } @@ -149,6 +161,7 @@ class Joystick final protected: unsigned char mDirection; + unsigned char mHatPosition; bool mActiveButtons[MAX_BUTTONS]; SDL_Joystick *mJoystick; |