-
-
Notifications
You must be signed in to change notification settings - Fork 183
Add pygame.mouse.get_just_pressed/released() #2836
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
itzpr3d4t0r
merged 11 commits into
pygame-community:main
from
damusss:mouse-get-just-pressed-released
May 18, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0f7d1d7
Add pygame.mouse.get_just_pressed/released + stubs, tests, docs
damusss cc2f938
Added user docs
damusss 03450fd
Fix format issue caused by clang-format
damusss b5ee147
Rename buttons variable
damusss 9b0ec14
Docs syntax fix
damusss fbf422e
Rename API functions for clarity
damusss 3fd4e4e
Remove num_button args, update docs
damusss 83df0a0
Add METH_NOARGS to function signature
damusss 15845dd
Fix language in docs
damusss d89b160
add missing newlines
damusss 9b3fbb5
Fix typo and docs
damusss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What if the mouse doesn't support 5 buttons here? Just being curious here. And also what if we made these function configurable concerning the number of buttons we want to return? like by passing in an optional int like num_buttons.
Would require METH_FASTCALL tho.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hi,
That's what MyreMylar talked about in the first comment. If the mouse doesn't support the buttons, the entries will always be
False
, and I personally don't see an issue with that. The tuple values come from a function that I created (edit: don't want to remove credits to who made it for the key module as I used it as a base) which memsets to 0, and if no events with those buttons are passed, it will never be set to 1.The
num_buttons
added to get_pressed was for compatibility between pygame 1 and pygame 2 (added by MyreMylar) and MyreMylar even suggested that it could be removed with pygame 3. This is new API, so it doesn't need it. Removing that argument also cleaned up the code a lot.