Skip to content

change system variable to variable #572

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
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_frame_count.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = frameCount

@@ description
The system variable `frame_count` contains the number of frames that have been displayed since the program started. Inside `setup()` the value is 0. Inside the first execution of `draw()` it is 1, and it will increase by 1 for every execution of `draw()` after that.
The variable `frame_count` contains the number of frames that have been displayed since the program started. Inside `setup()` the value is 0. Inside the first execution of `draw()` it is 1, and it will increase by 1 for every execution of `draw()` after that.

@@ example
def setup():
Expand Down
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_key.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = key

@@ description
The system variable `key` always contains the value of the most recent key on the keyboard that was used (either pressed or released).
The variable `key` always contains the value of the most recent key on the keyboard that was used (either pressed or released).

For non-ASCII keys, use the [](sketch_key_code) variable. The keys included in the ASCII specification (`BACKSPACE`, `TAB`, `ENTER`, `RETURN`, `ESC`, and `DELETE`) do not require checking to see if the key is coded, and you should simply use the `key` variable instead of [](sketch_key_code). If you're making cross-platform projects, note that the `ENTER` key is commonly used on PCs and Unix and the `RETURN` key is used instead on Macintosh. Check for both `ENTER` and `RETURN` to make sure your program will work for all platforms.

Expand Down
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_mouse_button.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = mouseButton

@@ description
When a mouse button is pressed, the value of the system variable `mouse_button` is set to either `LEFT`, `RIGHT`, or `CENTER`, depending on which button is pressed. (If no button is pressed, `mouse_button` may be reset to `0`. For that reason, it's best to use `mouse_pressed` first to test if any button is being pressed, and only then test the value of `mouse_button`, as shown in the examples.)
When a mouse button is pressed, the variable `mouse_button` is set to either `LEFT`, `RIGHT`, or `CENTER`, depending on which button is pressed. (If no button is pressed, `mouse_button` may be reset to `0`. For that reason, it's best to use `mouse_pressed` first to test if any button is being pressed, and only then test the value of `mouse_button`, as shown in the examples.)

@@ example
# click within the image and press
Expand Down
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_mouse_x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = mouseX

@@ description
The system variable `mouse_x` always contains the current horizontal coordinate of the mouse.
The variable `mouse_x` always contains the current horizontal coordinate of the mouse.

Note that py5 can only track the mouse position when the pointer is over the current window. The default value of `mouse_x` is `0`, so `0` will be returned until the mouse moves in front of the Sketch window. (This typically happens when a Sketch is first run.) Once the mouse moves away from the window, `mouse_x` will continue to report its most recent position.

Expand Down
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_mouse_y.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = mouseY

@@ description
The system variable `mouse_y` always contains the current vertical coordinate of the mouse.
The variable `mouse_y` always contains the current vertical coordinate of the mouse.

Note that py5 can only track the mouse position when the pointer is over the current window. The default value of `mouse_y` is `0`, so `0` will be returned until the mouse moves in front of the Sketch window. (This typically happens when a Sketch is first run.) Once the mouse moves away from the window, `mouse_y` will continue to report its most recent position.

Expand Down
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_pmouse_x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = pmouseX

@@ description
The system variable `pmouse_x` always contains the horizontal position of the mouse in the frame previous to the current frame.
The variable `pmouse_x` always contains the horizontal position of the mouse in the frame previous to the current frame.

You may find that `pmouse_x` and [](sketch_pmouse_y) have different values when referenced inside of `draw()` and inside of mouse events like `mouse_pressed()` and `mouse_moved()`. Inside `draw()`, `pmouse_x` and [](sketch_pmouse_y) update only once per frame (once per trip through the `draw()` loop). But inside mouse events, they update each time the event is called. If these values weren't updated immediately during mouse events, then the mouse position would be read only once per frame, resulting in slight delays and choppy interaction. If the mouse variables were always updated multiple times per frame, then something like `line(pmouse_x, pmouse_y, mouse_x, mouse_y)` inside `draw()` would have lots of gaps, because `pmouse_x` may have changed several times in between the calls to [](sketch_line).

Expand Down
2 changes: 1 addition & 1 deletion py5_docs/Reference/api_en/Sketch_pmouse_y.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pclass = PApplet
processing_name = pmouseY

@@ description
The system variable `pmouse_y` always contains the vertical position of the mouse in the frame previous to the current frame.
The variable `pmouse_y` always contains the vertical position of the mouse in the frame previous to the current frame.

For more detail on how `pmouse_y` is updated inside of mouse events and `draw()`, see the reference for [](sketch_pmouse_x).

Expand Down