-
-
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
[Merged by Bors] - Add convenience methods for checking a set of inputs #2760
Conversation
Can you add |
Maybe? I feel like that is less useful, because all the modifier keys have at least two versions - e.g. left control and right control. I definitely would add that if there's consensus that it's useful though. |
Definitely looks useful! Some "due diligence" questions:
|
I think merge now, think about action system later is the most reasonable choice. |
|
Cool I agree that merging this now is probably the right choice, just didn't want to bias things when introducing the questions :). I think |
bors r+ |
# Objective Make it easier to check if some set of inputs matches a key, such as if you want to allow all of space or up or w for jumping. Currently, this requires: ```rust if keyboard.pressed(KeyCode::Space) || keyboard.pressed(KeyCode::Up) || keyboard.pressed(KeyCode::W) { // ... ``` ## Solution Add an implementation of the helper methods, which very simply iterate through the items, used as: ```rust if keyboard.any_pressed([KeyCode::Space, KeyCode::Up, KeyCode::W]) { ```
Objective
Make it easier to check if some set of inputs matches a key, such as if you want to allow all of space or up or w for jumping.
Currently, this requires:
Solution
Add an implementation of the helper methods, which very simply iterate through the items, used as: