Skip to content

Commit 9a90e64

Browse files
committed
clarification (and removing some spaces)
1 parent dd32f1f commit 9a90e64

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

build/shared/changes.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
*Revision 1282 – 3 March 2022*
44

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.
66

77
…it also rolls back a change that broke Python Mode. Sorry, snake people!
88

@@ -20,17 +20,17 @@ The main thing for this release is to prevent an issue where code might be delet
2020

2121
## I'm just here for the ratio
2222

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.
2426

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-
2727
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:
2828

2929
```processing
3030
void setup() {
3131
windowResizable(true);
3232
windowRatio(1280, 720);
33-
33+
3434
cursor(CROSS);
3535
strokeWeight(10);
3636
}
@@ -39,21 +39,21 @@ void draw() {
3939
background(240);
4040
fill(255);
4141
rect(0, 0, rwidth, rheight);
42-
42+
4343
fill(0);
4444
textAlign(CENTER, CENTER);
4545
textSize(200);
4646
text(rmouseX + ", " + rmouseY, rwidth/2, rheight/2);
4747
}
4848
```
4949

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.
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.
5151

5252
Similarly, `rmouseX` and `rmouseY` contain the mouse position, scaled by the current ratio.
5353

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.)
5555

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`.
5757

5858
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.)
5959

0 commit comments

Comments
 (0)