Differences in window size acquisition methods

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bgegg

These all look the same
What is the difference?

:bust_in_silhouette: Reply From: estebanmolca

According to what I understand:
size is a property of the Viewport class that returns its size, get_viewport_rect () is a function of the CanvasItem class that returns a Rect2 type (position x, position y, width, height) of the viewport.
With get_viewport_rect ().position we get x and y, with get_viewport_rect ().size we get width and height.
The scene root always has a main vieport that is the same size as the window (OS.get_windows_size ()) in which it runs. But as we can put more viewports on the scene with different sizes, they are called render target. If we point to any of these with get_viewport_rect ().size or with get_viewport ().size the results may be different from the size of the main window.

The results are all the same
Thank you

bgegg | 2019-11-20 20:33