using Godot; namespace Pong.Scripts.Managers; public partial class MainMenuManager : VBoxContainer { // Called when the node enters the scene tree for the first time. public override void _Ready() { GetTree().Root.SizeChanged += AdaptUiToScreenResolution; AdaptUiToScreenResolution(); } /// /// code that executes when the start button is pressed. this loads the Pong scene to the root /// of the scene tree. /// private void OnButtonPressed() { GetTree().Root.SizeChanged -= AdaptUiToScreenResolution; GetTree().ChangeSceneToFile("res://Scenes/Pong.tscn"); } private void AdaptUiToScreenResolution() { Size = DisplayServer.WindowGetSize(); } }