diff options
author | ewewukek <ewewukek@gmail.com> | 2024-01-10 23:26:42 +0300 |
---|---|---|
committer | ewewukek <ewewukek@gmail.com> | 2024-03-27 13:18:30 +0300 |
commit | 7c6feeb44a614985ea957c5ca431e331fd41d216 (patch) | |
tree | 6d8882113443407975c5af9ce22a90c6bd972fd6 /src/input/joystick.h | |
parent | 9802c54b0a5094d5f118a2a21d1518fa8fe245b8 (diff) | |
download | manaverse-7c6feeb44a614985ea957c5ca431e331fd41d216.tar.gz manaverse-7c6feeb44a614985ea957c5ca431e331fd41d216.tar.bz2 manaverse-7c6feeb44a614985ea957c5ca431e331fd41d216.tar.xz manaverse-7c6feeb44a614985ea957c5ca431e331fd41d216.zip |
Switch joystick axis tolerance type to float
Diffstat (limited to 'src/input/joystick.h')
-rw-r--r-- | src/input/joystick.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/input/joystick.h b/src/input/joystick.h index d90420395..32fdddf2e 100644 --- a/src/input/joystick.h +++ b/src/input/joystick.h @@ -31,6 +31,15 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_events.h> PRAGMA48(GCC diagnostic pop) +// defined first in SDL 2.0.6 +// not available on older distros +#ifndef SDL_JOYSTICK_AXIS_MIN +#define SDL_JOYSTICK_AXIS_MIN -32768 +#endif +#ifndef SDL_JOYSTICK_AXIS_MAX +#define SDL_JOYSTICK_AXIS_MAX 32767 +#endif + class Joystick final { public: @@ -115,7 +124,7 @@ class Joystick final int getNumber() const noexcept2 A_WARN_UNUSED { return mNumber; } - void setTolerance(const int tolerance) + void setTolerance(const float tolerance) { mTolerance = tolerance; } void setUseInactive(const bool b) @@ -144,7 +153,7 @@ class Joystick final SDL_Joystick *mJoystick; - int mTolerance; + float mTolerance; int mNumber; int mButtonsNumber; bool mUseInactive; |