diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2023-08-24 18:22:20 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-11-19 23:11:13 +0100 |
commit | 0cf99cf95d098392d7d1943aac37b12bd831a1d9 (patch) | |
tree | 6d148ad2a80fc59bd77a2ce34075e0dfd1ca91cd /platform/javascript/pre_asmjs.js | |
parent | a3080477ac0421aef24ca0916c40559abbf4846b (diff) | |
download | redot-engine-0cf99cf95d098392d7d1943aac37b12bd831a1d9.tar.gz |
Add a Viewport method to get automatically computed 2D stretch transform
`Viewport.get_stretch_transform()` returns the automatically computed
2D stretch transform. Combined with `Transform2D.get_scale()`, this is
useful when using the `canvas_items` stretch mode in a project.
There are many situations where knowing this factor is useful:
- Divide Camera2D zoom to keep the size of the 2D game world identical
regardless of the 2D scale factor (so that UI elements can still be scaled).
- Make certain controls always drawn at 1:1 scale
(e.g. for the crosshair in a FPS). This is done by dividing the Control
node's scale by the scale factor.
Diffstat (limited to 'platform/javascript/pre_asmjs.js')
0 files changed, 0 insertions, 0 deletions