Closed villares closed 2 years ago
This is a good idea and an easy thing to change. Thanks for pointing this out!!
I sat down today ready to write the "easy thing to change" and I discovered a proper solution for this is more complex but will be a worthwhile enhancement. If it was just getCount()
=> get_count()
it would be easy, but there is more to it.
Looking at the Processing documentation, I see the syntax for the user-defined mouseWheel
method is mouseWheel(event)
, but when I look at the other user-defined mouse or keyboard defined events such as mouseDragged
I see the syntax can be mouseDragged()
or mouseDragged(event)
. Same thing for keyPressed
, and many others They can all optionally be passed an event object.
Right now, py5 only passes the event object to a user-defined mouse_wheel
function, and the function must take that argument, it is not optional. There is no way for the other user-defined key and mouse functions to get the KeyEvent or MouseEvent objects, and I think it would be great if it did.
Implementing a proper enhancement for this isn't that big of a change but it will be a bit involved. Since I aspire to get a release out next week, I am going to defer this to the next release when I have more time.
Also I'll point out I noticed in the Processing code that there is a prototype TouchEvent
object and I want py5 to be prepared for for that when touch events get added to Processing!
Started working on this, will definitely be in the next release
The coding is done! This works perfectly. Now I just need to write the docstrings and example code.
All done. Will start thinking about the next release.
When creating a
mouse_wheel
event function, it receives anevent
object. It could be nice to have.get_count()
as a method alias, maybe...