Godot Version 4.2
problem
2D game, hand drawn sprites.
I’m making a resolution change option. But when I’m changing it, game dispaly brokes.
native resolution for game is 1080p.
project settings
resolution change code
var resolutions := { # resolutions list
"4k":Vector2(3840,2160),
"1440p":Vector2(2560,1440),
"1080p":Vector2(1920,1080),
"720p":Vector2(1280,720)
}
# change res function
func Change_resolution(index):
var selected_res = resolutions.get(res_selector.get_item_text(index))
get_viewport().size = selected_res
screenshots
noraml 1080p
1080p → 1440p
1080p → 4k
Expected behaviour
I expect that the game will be always in fullscreen and in screen border. With resolution change will change scale of interface and quality of art.
what I tried but it didn’t work
I tried use method ProjectSettings.set_setting()
but it didnt do anyting
I tried different project settings, but it behaves wrong, or resolution doesnt change.
QUESTION
How to properly set project settings and change resolution with code for 2D game (with hand drawn sprites)?
Godot Version 4.2