py5coding / py5generator

Meta-programming project that creates the py5 library code.
https://py5coding.org/
GNU General Public License v3.0
52 stars 13 forks source link

Documentation: "If you come from Processing Java/Python" page #196

Closed villares closed 9 months ago

villares commented 1 year ago

I can't remember if there is already such a page, forgive me if there is already.

Things to mention:

PS: Should this be a discussion instead of an issue?

hx2A commented 1 year ago

This is useful! Thank you for posting this.

I can't remember if there is already such a page, forgive me if there is already.

The page doesn't exist but it should. I'll use these comments as a starting point. Please add to this as you think of things.

@marcovicci , you might think of things that should be included here also.

The reason behind the is_key_pressed and is_mouse_pressed stuff has to do with Python and imported mode. In Java, you can have a variable and a method with the same name. For example, Processing has the float frameRate for the actual frame rate and frameRate() to set the desired frame rate. Java can distinguish between the two when it compiles your code. Python does not have the ability for multiple things to share the same name.

The is_key_pressed and is_mouse_pressed stuff is a bit different because the key_pressed() and mouse_pressed() functions are defined by the user, not py5. But in imported mode, there would be a name conflict that would interfere with how imported mode works. Therefore, the is_ prefix was added.

villares commented 9 months ago

Let's move this to discussions!

If things get moving we could open a new issue on py5coding/py5book maybe?

At the discussions forum: https://github.com/py5coding/py5generator/discussions/389