Godot Version
4.2
Question
Is it possible to change the viewport width and height through code as well as the window width override and the window height override?
I can’t seem to find out how to change these two separately.
4.2
Is it possible to change the viewport width and height through code as well as the window width override and the window height override?
I can’t seem to find out how to change these two separately.
Use Window.size
to change the size of the window:
Example:
extends Node
func change_size(new_size:Vector2i) -> void:
get_window().size = new_size
The issue I’m having might have to do with the fact that i’m using integer scaling so that the pixel art looks good.
Here is my game with a 16:9 aspect ratio:
And here it is when I change it to 4:3:
I want it to somehow fit the screen when I change the resolution while still being pixel perfect but the viewport seems to be stuck at a 16:9 resolution.
Then you will also need to change the Window.content_scale_size
property with the correct values
That was what I was looking for, thank you so much!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.