-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[p5.js 2.0 RFC Proposal]: expand keyIsDown() to work with characters as arguments #6798
Comments
Hi, I'd like to work on this, thank you! |
Hi, I'd like to work on this, thank you! I think I solve it. |
Sorry I don't know if this is a right pin @limzykenneth, I saw that you are under I/O and I am currently working on the implementation for this. It seems to be a conflict for the const "LEFT_ARROW" with the purposed solutions of using String as a input. I can propose 2 solutions.
|
Hey, I made a working draft PR above for The documentation is also updated to reflect the changes with examples now included for the new changes. Let me know if any unit tests are necessary for these changes (based on the current tests for Feedback is much appreciated :) |
@wwwld1 I think |
Increasing access
Having some symmetry where you can also do:
would be useful for teaching beginners.
Which types of changes would be made?
Most appropriate sub-area of p5.js?
What's the problem?
keyIsDown()
currently only works with keycodes. Sometimes this is confusing for my students, because they can use this for things like:but if they want to check if an alphanumeric key is down, the code is different:
What's the solution?
keyIsDown()
would need an addition that checks the type of the argument and allows passing text/characters. This means p5.js would have some symmetry where you can also do:Pros (updated based on community comments)
Example list:
keyIsDown()
;keyIsDown()
without having to look up keycodesCons (updated based on community comments)
keyIsDown(4)
where the user might mean the number 4? (note that 3, 8, and 9 are valid keycodes, so we can't just allow all numbers < 10)Proposal status
Under review
The text was updated successfully, but these errors were encountered: