- Edited
Hello all. I've a question regarding the capture event of a window been resized
My code is as follows. Works fine if i don't change the resolution (works with full screen and windowed screen). But I would like to call the _center_hud when there's a change in the window dimension.
Thanks
extends CenterContainer
var screen_x =0
var screen_y =0
# Called when the node enters the scene tree for the first time.
func _ready():
#screen_metrics()
_center_hud()
func _center_hud():
screen_x=OS.get_real_window_size().x
screen_y=OS.get_real_window_size().y
self.rect_position.x=screen_x/2
self.rect_position.y=screen_y/2
func screen_metrics():
print("[Screen Metrics]")
print("Display size: ", OS.get_screen_size())
print("Decorated Window size: ", OS.get_real_window_size())
print("Window size: ", OS.get_window_size())
print("Project Settings: Width=", ProjectSettings.get_setting("display/window/size/width"), " Height=", ProjectSettings.get_setting("display/window/size/height"))
print(OS.get_window_size().x)
print(OS.get_window_size().y)
func _on_Control_size_flags_changed():
_center_hud()