-
Notifications
You must be signed in to change notification settings - Fork 19
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 new API function to test which buttons are pressed #56
Comments
Example/clarification: new function
|
If the API returns the bit mask directly like in the example above, then you can define |
So like instead of my suggested also I don't see an existing |
The update() method I'm referring to:
If your frames take a long time to run, you can call My point is that it's possible to replicate the three methods of |
OH! Gotcha. Yeah we're both saying the same thing, thanks for the explanation. |
On further thought, maybe one of the extra bits (like 7) should represent 'newly pressed this frame' or 'newly pressed since last update()' or something to distinguish from buttons being held previously? Then the final bit can just be 'Any button/direction pressed' instead of splitting those out? Let me know your thoughts, I'd like to get this theory-crafted well before it hopefully it's up in the API proper. |
I'm not sure what value one bit of information about new presses would add. The mask returned by Having special bits for "any direction" and "any A/B button" brings complications -- what meaning should those bits have in a just-pressed mask, when between two calls to Personally, I'm not sure what value there is to putting this in the official API. More advanced users who want to operate on button presses as bit masks can implement this with their desired behavior in very little code. Here is the entire button mask logic in my WIP game:
|
Good point It just felt right to round the register up to a full byte instead of 6 bits but you are correct it doesn't actually really add anything |
I've composed a PR that implements Jason's suggestion from the CPP library in #64. Button masks are defined inside the button base, and look like |
As discussed in the following comments on Discord:
it would be nice to have a button pressed function similar to the C++ Thumby library: https://github.com/TinyCircuits/TinyCircuits-Thumby-Lib/blob/master/src/Thumby.cpp#L120-L137
The text was updated successfully, but these errors were encountered: