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 Buttons.None #7818

Merged
merged 2 commits into from
Jun 14, 2022
Merged

Add Buttons.None #7818

merged 2 commits into from
Jun 14, 2022

Conversation

TimerbaevRR
Copy link
Contributor

@TimerbaevRR TimerbaevRR commented Jun 10, 2022

@TimerbaevRR
Copy link
Contributor Author

Fixes #7634

@TimerbaevRR TimerbaevRR marked this pull request as ready for review June 13, 2022 17:52
@mrhelmut mrhelmut merged commit 3954144 into MonoGame:develop Jun 14, 2022
@mrhelmut
Copy link
Contributor

Thanks!

@BaseCrosser
Copy link

About 6 years ago I also tried to add a Buttons.None. #4618
Doing this comes with some problems.

As was said back then the GamePad.GetState().IsButtonDown implementation is doing a bitwise & comparison between the pressed buttons and the parameter, but Anything & 0 returns 0, and 0 == 0 is always true
https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework/Input/GamePadState.cs#L138

With this implementation of adding Buttons.None and setting its value to 0 the result of querying GamePad.GetState().IsButtonDown(Buttons.None) would always return true.

@TimerbaevRR
Copy link
Contributor Author

@mrhelmut Maybe should we revert this PR?
I will try to fix problems and create new PR

@mrhelmut
Copy link
Contributor

I don't feel like there is a need to revert this PR, it doesn't seem to cause any harm.

We should be fine with a if (button == Buttons.None) return false in IsButtonDown().

@mrhelmut mrhelmut mentioned this pull request Jun 22, 2022
@mrhelmut
Copy link
Contributor

I went ahead because the test were failing because of this and I'm looking into restoring them: #7822

viniciusjarina pushed a commit to codefoco/MonoGame that referenced this pull request Jul 4, 2022
* Added Buttons.None MonoGame#7634

* comment fix

Co-authored-by: Rust <savage@speccy.su>
bytinggames pushed a commit to bytinggames/MonoGame that referenced this pull request Oct 9, 2022
* Added Buttons.None MonoGame#7634

* comment fix

Co-authored-by: Rust <savage@speccy.su>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants