input_common: Add manual update options to input devices
This commit is contained in:
parent
f01dac3bf9
commit
c6c32daf40
5 changed files with 56 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue