Skip to content
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

Trigger some type of ButtonEvent on but input #17522

Open
spvky opened this issue Jan 24, 2025 · 1 comment
Open

Trigger some type of ButtonEvent on but input #17522

spvky opened this issue Jan 24, 2025 · 1 comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Design This issue requires design work to think about how it would best be accomplished

Comments

@spvky
Copy link
Contributor

spvky commented Jan 24, 2025

What problem does this solve or what need does it fill?

This could just be a random pattern that's been on my mind, but with the inclusion of observer systems I've found they offer huge ergonomics win for a lot of different pieces of game logic and I wonder if it would be useful/desirable to have bevy trigger some sort of ButtonInputEvent<T> for things like keystrokes, mouse clicks, game pad button presses etc.

What solution would you like?

A simple, first class event that is triggered by bevy in response to user input

What alternative(s) have you considered?

This could fairly easily be done on an as need basis for anyone who desires this, I'm more gauging interest on if this would be worth adding?

p.s. I am not privy to any performance overhead that Trigger events that are not picked up have, so if It would be a disastrous feature to add that would be good to know as well

@spvky spvky added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 24, 2025
@BenjaminBrienen BenjaminBrienen added A-Input Player input via keyboard, mouse, gamepad, and more S-Needs-Design This issue requires design work to think about how it would best be accomplished D-Straightforward Simple bug fixes and API improvements, docs, test and examples and removed S-Needs-Triage This issue needs to be labelled labels Jan 24, 2025
@spvky
Copy link
Contributor Author

spvky commented Jan 24, 2025

My initial thoughts on implementation:

  1. Create a generic event type that accepts all of our first class input keys, most likely one for pressed and one for released
  2. Wherever the existing logic is to mark a button as pressed/released, trigger a command for that same input event
  3. Add an input example for consuming this pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Design This issue requires design work to think about how it would best be accomplished
Projects
None yet
Development

No branches or pull requests

2 participants