You can do that with the function get_tree().set_screen_stretch()
. That function takes the following arguments, which can all be referenced through SceneTree constants:
StretchMode (2D, Viewport, Disabled)
Aspect (Ignore, Keep, Expand)
MinSize (Vector2(x,y))
So, what you'll want to actually change is that 3rd argument. A simple call like this on the scene's _ready()
will show you whether it's working or not:
func _ready():
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D,SceneTree.STRETCH_ASPECT_KEEP,Vector2(160,100))
If you also want to force the screen into fullscreen, you'll have to set a OS parameter: OS.window_fullscreen = true