compsci_godot_albert/_subsections/sec03/lesson-05.org
2024-11-27 04:24:34 +02:00

1.3 KiB

Section 03 - Lesson 05 | Windows and Viewports

Notes

when running the game godot creates a window

and within that window is a child of it called a viewport which is the rendering surface it initially fits inside the window

we frequently ask for the "visible rect" within the viewport

key properties are origin, height and width

we can move the viewport by changing the viewport origin

changing window size

when the window is changed in size, the viewport is grown as opposed to stretched

there are options to change the scaling types.

what is rendered

the viewport renders a single visual root scene at a time this root has a scene playing on it.

get_tree().root - the root of the tree

a root can have a number of scenes, but only one is being rendered we can change the scene being shown or rendered.

subviewports

you can add scenes with their own sub viewports, e.g. mini maps