I would like to switch between fullscreen and windowed mode. Is there some way to do that without restarting whole game?
SFML C# How do I switch between fullscreen?
561 Views Asked by Etwus At
2
There are 2 best solutions below
0
On
Under C# you can't access ->create like C. you have to close the old RenderWindows and create a new one.
if (Keyboard.IsKeyPressed(Keyboard.Key.Enter) && Keyboard.IsKeyPressed(Keyboard.Key.LAlt) && !auxChangeStyle)
{
auxStyle = (auxStyle == Styles.Default)? Styles.Fullscreen: Styles.Default;
window.Close();
window = new RenderWindow(new VideoMode(800, 600), "Title", auxStyle);
window.Closed += (_, __) => window.Close(); //reassign the event handlers
}
I would suggest calling the create method on your window (C++, but I'm sure it works in C# as well):