How to change base resolution?

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

Okay, so you know how in project settings you have display → window → size? I want to change that value and have it affect the game during runtime. The docs say that I can’t do this since those values are determined at start up. How can I change that value at start up then?

:bust_in_silhouette: Reply From: Gluon

Well you can use

OS::set_window_size

to set the window size but I dont know what would happen if you tried to set it too a larger size than the current OS setup. You could use something like the below.

func _ready():
    When something is true:
         Resize_Screen(640, 480)

func Resize_Screen(First, Second):
    OS.set_window_size(Vector2(First, Second))

Which would allow you to set the window size to anything you passed as arguments.

I don’t want to change the window size. I want to change the resolution of the game.

exuin | 2021-12-21 02:55

Check the TPS demo, the options part. It’s done with viewports. I dont remember more details by mind

heavyathan | 2021-12-24 18:43