diff options
author | CJBok <cjbok@ziggo.nl> | 2020-01-15 11:25:15 +0100 |
---|---|---|
committer | CJBok <cjbok@ziggo.nl> | 2020-01-15 11:25:15 +0100 |
commit | 635deb70d4c7b09749d9d7edb9515ede496f7f3e (patch) | |
tree | 05b9fd2d60b606ca01f45fa9739b498235d6296a /src/input_common/sdl | |
parent | Corrected directional states sensitivity (diff) | |
download | yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.tar yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.tar.gz yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.tar.bz2 yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.tar.lz yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.tar.xz yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.tar.zst yuzu-635deb70d4c7b09749d9d7edb9515ede496f7f3e.zip |
Diffstat (limited to 'src/input_common/sdl')
-rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index d2e9d278f..a2e0c0bd2 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -342,6 +342,22 @@ public: return std::make_tuple<float, float>(0.0f, 0.0f); } + bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { + const auto [x, y] = GetStatus(); + const float directional_deadzone = 0.4f; + switch (direction) { + case Input::AnalogDirection::RIGHT: + return x > directional_deadzone; + case Input::AnalogDirection::LEFT: + return x < -directional_deadzone; + case Input::AnalogDirection::UP: + return y > directional_deadzone; + case Input::AnalogDirection::DOWN: + return y < -directional_deadzone; + } + return false; + } + private: std::shared_ptr<SDLJoystick> joystick; const int axis_x; |