diff options
author | german77 <juangerman-13@hotmail.com> | 2021-11-02 02:49:14 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2021-11-25 03:30:27 +0100 |
commit | 136eb9c4c2b2425c2dd45a79cf444dee7170714d (patch) | |
tree | 74a055a08126fdd33b2071baa08125177847db6e /src/input_common/helpers/stick_from_buttons.cpp | |
parent | second commit lion review (diff) | |
download | yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.gz yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.bz2 yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.lz yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.xz yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.zst yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.zip |
Diffstat (limited to 'src/input_common/helpers/stick_from_buttons.cpp')
-rw-r--r-- | src/input_common/helpers/stick_from_buttons.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/input_common/helpers/stick_from_buttons.cpp b/src/input_common/helpers/stick_from_buttons.cpp index 1d5948f79..77fcd655e 100644 --- a/src/input_common/helpers/stick_from_buttons.cpp +++ b/src/input_common/helpers/stick_from_buttons.cpp @@ -36,6 +36,8 @@ public: left->SetCallback(button_left_callback); right->SetCallback(button_right_callback); modifier->SetCallback(button_modifier_callback); + last_x_axis_value = 0.0f; + last_y_axis_value = 0.0f; } bool IsAngleGreater(float old_angle, float new_angle) const { @@ -199,6 +201,8 @@ public: .type = Common::Input::InputType::Stick, .stick_status = GetStatus(), }; + last_x_axis_value = status.stick_status.x.raw_value; + last_y_axis_value = status.stick_status.y.raw_value; TriggerOnChange(status); } @@ -215,6 +219,12 @@ public: .type = Common::Input::InputType::Stick, .stick_status = GetStatus(), }; + if (last_x_axis_value == status.stick_status.x.raw_value && + last_y_axis_value == status.stick_status.y.raw_value) { + return; + } + last_x_axis_value = status.stick_status.x.raw_value; + last_y_axis_value = status.stick_status.y.raw_value; TriggerOnChange(status); } @@ -265,6 +275,8 @@ private: bool left_status; bool right_status; bool modifier_status; + float last_x_axis_value; + float last_y_axis_value; const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false}; std::chrono::time_point<std::chrono::steady_clock> last_update; }; |