You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: build/shared/changes.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
*Revision 1282 – 3 March 2022*
4
4
5
-
The main thing for this release is to prevent an issue where code might be deleted (!) due to the change in beta 6.
5
+
The main thing for this release is to prevent an issue where files might be deleted (!) due to the change in beta 6.
6
6
7
7
…it also rolls back a change that broke Python Mode. Sorry, snake people!
8
8
@@ -20,17 +20,17 @@ The main thing for this release is to prevent an issue where code might be delet
20
20
21
21
## I'm just here for the ratio
22
22
23
-
Added a new `windowRatio(width, height)` function that remaps screen and mouse coordinates to the specified aspect ratio.
23
+
Added a new `windowRatio(width, height)` function that remaps screen and mouse coordinates to the specified aspect ratio.
24
+
25
+
The general idea is that you set a ratio, and whether you're using `fullScreen()` or `setResizable(true)`, the sketch will scale its coordinates (and the coordinates of the mouse to fit that same ratio.
24
26
25
-
The general idea is that you set a ratio, and whether you're using `fullScreen()` or `setResizable(true)`, the sketch will scale its coordinates (and the coordinates of the mouse to fit that same ratio.
26
-
27
27
For instance, use `windowRatio(1280, 720)` in your code, and then all your coordinates will be re-mapped to that range—but always keeping the aspect ratio. Probably easiest to see by running this sketch:
When using `windowRatio()`, the new `rwidth` and `rheight` variables contain the width and height that were passed to `windowRatio()` and can be used in place of `width` and `height` elsewhere in your code.
50
+
When using `windowRatio()`, the new `rwidth` and `rheight` variables contain the width and height that were passed to `windowRatio()` and can be used in place of `width` and `height` elsewhere in your code.
51
51
52
52
Similarly, `rmouseX` and `rmouseY` contain the mouse position, scaled by the current ratio.
53
53
54
-
If your window is taller (or wider) than the specified ratio, your sketch will be moved (using `translate()` to fit the space, and `rmouseX` and `rmouseY` might even have negative values if they're outside the box. (Again, try running the code above.)
54
+
If your window is taller (or wider) than the specified ratio, your sketch will be moved (using `translate()` to fit the space, and `rmouseX` and `rmouseY` might even have negative values if they're outside the box. (Again, try running the code above.)
55
55
56
-
The exact amount of space that's extra can be found in the `ratioLeft` and `ratioTop` variables. And the current `scale()` being used for the ratio can be found in `ratioScale`.
56
+
The exact amount of space that's extra can be found in the `ratioLeft` and `ratioTop` variables. And the current `scale()` being used for the ratio can be found in `ratioScale`.
57
57
58
58
Mind you, it might be tempting to use windowRatio(16, 9), but keep in mind that means your horizontal coordinates will be numbers between 0 and (almost) 16, and vertical will be between 0 and 9. Not a great way to work! (And at some point, likely to introduce quirks as you learn about the inaccuracies of floating point number accuracy.)
0 commit comments