Skip to content

Commit 8ee6663

Browse files
zicklagTekhnaeRaav
andauthored
fix: add missing gilrs events. (#506)
This fixes gamepad buttons getting skipped on certain platforms Co-authored-by: Tekhnae Raav <[email protected]>
1 parent 84c5dc5 commit 8ee6663

File tree

1 file changed

+22
-0
lines changed
  • framework_crates/bones_framework/src/input

1 file changed

+22
-0
lines changed

framework_crates/bones_framework/src/input/gilrs.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,28 @@ pub fn process_gamepad_events() -> GamepadInputs {
5555
},
5656
));
5757
}
58+
EventType::ButtonPressed(gilrs_button, _) => {
59+
if let Some(button) = convert_button(gilrs_button) {
60+
gamepad_inputs
61+
.gamepad_events
62+
.push(GamepadEvent::Button(GamepadButtonEvent {
63+
gamepad,
64+
button,
65+
value: 1.0,
66+
}));
67+
}
68+
}
69+
EventType::ButtonReleased(gilrs_button, _) => {
70+
if let Some(button) = convert_button(gilrs_button) {
71+
gamepad_inputs
72+
.gamepad_events
73+
.push(GamepadEvent::Button(GamepadButtonEvent {
74+
gamepad,
75+
button,
76+
value: 0.0,
77+
}));
78+
}
79+
}
5880
EventType::ButtonChanged(gilrs_button, value, _) => {
5981
if let Some(button) = convert_button(gilrs_button) {
6082
gamepad_inputs

0 commit comments

Comments
 (0)