Merge pull request #110823 from Calinou/ui-builtin-actions-all-devices

Allow all gamepad devices for built-in `ui_*` input actions
This commit is contained in:
Thaddeus Crews 2025-10-07 17:15:00 -05:00
commit 6ef2c7b34b
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
3 changed files with 9 additions and 7 deletions

View file

@ -1188,11 +1188,12 @@ String InputEventJoypadMotion::to_string() {
return vformat("InputEventJoypadMotion: axis=%d, axis_value=%.2f", axis, axis_value);
}
Ref<InputEventJoypadMotion> InputEventJoypadMotion::create_reference(JoyAxis p_axis, float p_value) {
Ref<InputEventJoypadMotion> InputEventJoypadMotion::create_reference(JoyAxis p_axis, float p_value, int p_device) {
Ref<InputEventJoypadMotion> ie;
ie.instantiate();
ie->set_axis(p_axis);
ie->set_axis_value(p_value);
ie->set_device(p_device);
return ie;
}
@ -1307,10 +1308,11 @@ String InputEventJoypadButton::to_string() {
return vformat("InputEventJoypadButton: button_index=%d, pressed=%s, pressure=%.2f", button_index, p, pressure);
}
Ref<InputEventJoypadButton> InputEventJoypadButton::create_reference(JoyButton p_btn_index) {
Ref<InputEventJoypadButton> InputEventJoypadButton::create_reference(JoyButton p_btn_index, int p_device) {
Ref<InputEventJoypadButton> ie;
ie.instantiate();
ie->set_button_index(p_btn_index);
ie->set_device(p_device);
return ie;
}

View file

@ -339,7 +339,8 @@ public:
virtual String as_text() const override;
virtual String to_string() override;
static Ref<InputEventJoypadMotion> create_reference(JoyAxis p_axis, float p_value);
// The default device ID is `InputMap::ALL_DEVICES`.
static Ref<InputEventJoypadMotion> create_reference(JoyAxis p_axis, float p_value, int p_device = -1);
InputEventType get_type() const final override { return InputEventType::JOY_MOTION; }
@ -371,7 +372,8 @@ public:
virtual String as_text() const override;
virtual String to_string() override;
static Ref<InputEventJoypadButton> create_reference(JoyButton p_btn_index);
// The default device ID is `InputMap::ALL_DEVICES`.
static Ref<InputEventJoypadButton> create_reference(JoyButton p_btn_index, int p_device = -1);
InputEventType get_type() const final override { return InputEventType::JOY_BUTTON; }