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

Add method to check if all inputs are pressed #11010

Merged
merged 1 commit into from Dec 18, 2023

Conversation

matiqo15
Copy link
Member

@matiqo15 matiqo15 commented Dec 17, 2023

Objective

  • Provide way to check whether multiple inputs are pressed.

Solution

  • Add all_pressed method that checks if all inputs are currently being pressed.

@matiqo15 matiqo15 added C-Enhancement A new feature A-Input Player input via keyboard, mouse, gamepad, and more labels Dec 17, 2023
@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use and removed C-Enhancement A new feature labels Dec 17, 2023
@alice-i-cecile
Copy link
Member

Can you talk a bit about the motivation here? The all_pressed and maybe all_just_pressed forms make some sense as building blocks for chords, but I'm not seeing the full picture here.

@matiqo15
Copy link
Member Author

Yes, I meant them in a sense of using chords, also as we have any_pressed (and similar) which checks if one of the input is pressed, I would also expect a method for checking if all of the inputs are being pressed.

@AndrewB330
Copy link

I kinda see how all_pressed can be used, but I can't think of any good use for all_just_XXX, because there is basically 0 chance to achieve this in game, and if game mechanic is built on top of it I think this game mechanic is bad.

If somebody would want to implement a "press multiple keys simultaneously" mechanic they would need to do that manually anyway, they would need to add some "reaction threshold" window and each frame check if keys were pressed during this time window, because otherwise you are making the game difficulty dependent on frame rate, and realistically impossible, because nobody would press keys simultaneously and consistently within <16ms window.

@alice-i-cecile
Copy link
Member

Agreed, I think we should add all_pressed but none of the other variants.

@matiqo15
Copy link
Member Author

I haven't thought about that, I only needed all_pressed but thought while making this change I also should include other options. Will revert those.

@matiqo15 matiqo15 changed the title Add methods to check if all inputs are in some state Add method to check if all inputs are pressed Dec 17, 2023
@mockersf mockersf added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Dec 18, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 18, 2023
Merged via the queue into bevyengine:main with commit 2c7eab1 Dec 18, 2023
23 checks passed
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-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants