diff options
Diffstat (limited to '')
-rw-r--r-- | src/input_common/helpers/stick_from_buttons.cpp | 16 | ||||
-rw-r--r-- | src/input_common/helpers/touch_from_buttons.cpp | 1 | ||||
-rw-r--r-- | src/input_common/input_poller.cpp | 20 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/input_common/helpers/stick_from_buttons.cpp b/src/input_common/helpers/stick_from_buttons.cpp index 38f150746..9101f11ce 100644 --- a/src/input_common/helpers/stick_from_buttons.cpp +++ b/src/input_common/helpers/stick_from_buttons.cpp @@ -200,6 +200,22 @@ public: TriggerOnChange(status); } + void ForceUpdate() override{ + up->ForceUpdate(); + down->ForceUpdate(); + left->ForceUpdate(); + right->ForceUpdate(); + modifier->ForceUpdate(); + } + + void SoftUpdate() override { + Input::CallbackStatus status{ + .type = Input::InputType::Stick, + .stick_status = GetStatus(), + }; + TriggerOnChange(status); + } + Input::StickStatus GetStatus() const { Input::StickStatus status{}; status.x.properties = properties; diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp index 2abfaf841..bb2bad5b1 100644 --- a/src/input_common/helpers/touch_from_buttons.cpp +++ b/src/input_common/helpers/touch_from_buttons.cpp @@ -17,6 +17,7 @@ public: Input::InputCallback button_up_callback{ [this](Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }}; button->SetCallback(button_up_callback); + button->ForceUpdate(); } Input::TouchStatus GetStatus(bool pressed) const { diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 62ade951c..024bd28ef 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp @@ -45,6 +45,16 @@ public: }; } + void ForceUpdate() { + const Input::CallbackStatus status{ + .type = Input::InputType::Button, + .button_status = GetStatus(), + }; + + last_button_value = status.button_status.value; + TriggerOnChange(status); + } + void OnChange() { const Input::CallbackStatus status{ .type = Input::InputType::Button, @@ -96,6 +106,16 @@ public: }; } + void ForceUpdate() { + const Input::CallbackStatus status{ + .type = Input::InputType::Button, + .button_status = GetStatus(), + }; + + last_button_value = status.button_status.value; + TriggerOnChange(status); + } + void OnChange() { const Input::CallbackStatus status{ .type = Input::InputType::Button, |