-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GamepadButtonInput
event
#9008
Add GamepadButtonInput
event
#9008
Conversation
Resolves #8988
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue with trigger buttons (they have a value
that changes between 0.0 and 1.0) The Released
event is sent every time the value change, yet it should only be sent once when it goes from Pressed
to Released
. This is also true when the value changes but stays within Pressed
range.
mut connection_events: EventReader<GamepadConnectionEvent>, | ||
mut axis_changed_events: EventReader<GamepadAxisChangedEvent>, | ||
mut button_changed_events: EventReader<GamepadButtonChangedEvent>, | ||
mut button_input_events: EventReader<GamepadButtonInput>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would benefit from a comment explaining the difference between GamepadButtonInput
and GamepadButtonChangedEvent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good IMO. Nice work!
Note to readers: I considered the case where you get several events in a single frame. With this setup it should work as expected.
Ideally Also, regarding what you mentioned about comments in the example: I think the core problem here is the existing nomenclature having some ambiguous or overloaded meanings ("input" / "button" / "axis"). I saw an old discussion on the discord about renaming |
Supposedly the compiler is smart enough to eliminate the duplicate check.
Agree this should be part of a different PR. I'm not sure how It's the kind of breaking change that shouldn't count as breaking change. Sure if someone ignored the clippy lint and did |
@@ -74,6 +74,7 @@ impl Plugin for InputPlugin { | |||
// gamepad | |||
.add_event::<GamepadConnectionEvent>() | |||
.add_event::<GamepadButtonChangedEvent>() | |||
.add_event::<GamepadButtonInput>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it, but almost all other events have their name ending with Event
.
Could you either rename that new event to GamepadButtonInputEvent
, or renamed all the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GamepadButtonInput
was chosen to match the naming of KeyboardInput
; I agree the inconsistent naming isn't great, so it might be good to rename both of them to end with Event
.
Objective
Add
GamepadButtonInput
eventResolves #8988
Solution
GamepadButtonInput
typeGamepadButtonInput
events wheneverInput<GamepadButton>
is written to