fullscreen button works now
This commit is contained in:
parent
4f6832b658
commit
d933b16d3d
@ -25,6 +25,7 @@ public partial class Controller : Window
|
||||
this._btnScreen = this.GetNode<Button>("BtnScreen");
|
||||
this._btnClose = this.GetNode<Button>("BtnClose");
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@ -60,9 +61,13 @@ public partial class Controller : Window
|
||||
|
||||
if (this._btnScreen.IsPressed() && this._screenReady)
|
||||
{
|
||||
this.GetTree().GetRoot().GetNode<MainScript>("Main").SetFullScreen();
|
||||
MainScript windowScript = (MainScript)this.GetTree().GetRoot().GetNode<MainScript>("Main");
|
||||
windowScript.SetFullScreen();
|
||||
this._screenReady = false;
|
||||
}
|
||||
else this._screenReady = true;
|
||||
else if (!this._btnScreen.IsPressed() && !this._screenReady)
|
||||
{
|
||||
this._screenReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,8 +17,11 @@ public partial class MainScript : Node2D
|
||||
|
||||
public void SetFullScreen()
|
||||
{
|
||||
Window window = this.GetTree().GetRoot().GetNode<Window>("Main.Projection");
|
||||
Window window = GetNode<Window>("Projection");
|
||||
GD.Print("Window: ", window);
|
||||
window.SetCurrentScreen(1);
|
||||
window.Borderless = true;
|
||||
window.SetSize(new Vector2I(1920, 1080));
|
||||
|
||||
DisplayServer.WindowSetMode(DisplayServer.WindowMode.ExclusiveFullscreen, window.GetWindowId());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user