|
| 1 | +# Processing 4.0 beta 7 |
| 2 | + |
| 3 | +*Revision 1282 – 3 March 2022* |
| 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, and also to undo a regression that broke Python Mode. Sorry, snake people! |
| 6 | + |
| 7 | +Also: a new feature! A very cool new feature! See below. |
| 8 | + |
| 9 | + |
| 10 | +## Regression Repair |
| 11 | + |
| 12 | +* Bring back `getMainProgram()` for Python Mode. [#409](https://github.com/processing/processing4/issues/409) |
| 13 | + |
| 14 | +* Fix an issue where opening a single .pde file in an unrelated folder (i.e. Downloads) would delete the entire folder when deleting the "sketch" without being 100% obvious what it was doing. [#424](https://github.com/processing/processing4/issues/424) |
| 15 | + |
| 16 | +* Andrés tracked down the problem with `POINTS` and `PShape` that was introduced in 4.0 beta 3. [#345](https://github.com/processing/processing4/issues/345), [#432](https://github.com/processing/processing4/pull/432) |
| 17 | + |
| 18 | + |
| 19 | +## I'm just here for the ratio |
| 20 | + |
| 21 | +Added a new `windowRatio(width, height)` function that remaps screen and mouse coordinates to the specified aspect ratio. |
| 22 | + |
| 23 | +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 | + |
| 25 | +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: |
| 26 | + |
| 27 | +```processing |
| 28 | +void setup() { |
| 29 | + windowResizable(true); |
| 30 | + windowRatio(1280, 720); |
| 31 | + |
| 32 | + cursor(CROSS); |
| 33 | + strokeWeight(10); |
| 34 | +} |
| 35 | +
|
| 36 | +void draw() { |
| 37 | + background(240); |
| 38 | + fill(255); |
| 39 | + rect(0, 0, rwidth, rheight); |
| 40 | + |
| 41 | + fill(0); |
| 42 | + textAlign(CENTER, CENTER); |
| 43 | + textSize(200); |
| 44 | + text(rmouseX + ", " + rmouseY, rwidth/2, rheight/2); |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +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. |
| 49 | + |
| 50 | +Similarly, `rmouseX` and `rmouseY` contain the mouse position, scaled by the current ratio. |
| 51 | + |
| 52 | +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.) |
| 53 | + |
| 54 | +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`. |
| 55 | + |
| 56 | +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.) |
| 57 | + |
| 58 | + |
| 59 | +## Minor Mites |
| 60 | + |
| 61 | +* Half a dozen other fixes/changes for opening sketches and how it identifies the Mode and the rest. If you notice anything weird, let us know asap. |
| 62 | + |
| 63 | +* Rewrote our native code for going full screen on macOS, retiring jAppleMenuBar after a decade of service. Also gets things working on Apple Silicon. |
| 64 | + |
| 65 | +* Prevent “You must first install tweak Mode to use this sketch” when using sketches that date back to 2.0. [#415](https://github.com/processing/processing4/issues/415) |
| 66 | + |
| 67 | +* Swap more uses of `Util.deleteFile()` and move files to the Trash (or Recycle Bin) instead. This can make more mess, but it reduces the chances of something bad happening when Processing deletes a file. |
| 68 | + |
| 69 | +* Change straight quotes to smart quotes in the `PDE.properties` file. This just means that more UI and error messages will have nicer quotes. |
| 70 | + |
| 71 | + |
1 | 72 | # Processign 4.0 beta 6
|
2 | 73 |
|
3 | 74 | *Revision 1281 – 13 February 2022*
|
|
0 commit comments