SFML community forums

Help => Window => Topic started by: DigitalBombDev on March 22, 2016, 08:58:07 pm

Title: C#/SFML.NET -- Change Window Resolution
Post by: DigitalBombDev on March 22, 2016, 08:58:07 pm
Hey everyone,

I feel like this should be simple, but I can't for the life of me figure out how to change the resolution of a currently existing RenderWindow in SFML.NET 2.3.

Seems like in C++ you just need to call Create with the new resolution, but that function doesn't exist in SFML.NET. My current code looks like this:

            windowWidth = (uint)Int32.Parse(splitRes[0].Trim());
            windowHeight = (uint)Int32.Parse(splitRes[1].Trim());

            window = new RenderWindow(new VideoMode(windowWidth, windowHeight), "Faunus Fields", Styles.None);

            GUIView = new View(new FloatRect(0, 0, Game.windowWidth, Game.windowHeight));
            FadeOverlay = new RectangleShape(new Vector2f(Game.windowWidth, Game.windowHeight));

But all I get is a white screen that won't display anything (I clear the window each draw call to black, so it's not  clearing/displaying at all as far as I can tell).

Any ideas? I can provide more info if needed.
Title: AW: C#/SFML.NET -- Change Window Resolution
Post by: eXpl0it3r on March 22, 2016, 09:46:43 pm
If you have a reference to the old window that you keep clearing and don't update the reference to the newly created window, the new window won't be cleared.
But that's just a guess.
Title: Re: C#/SFML.NET -- Change Window Resolution
Post by: DigitalBombDev on March 24, 2016, 02:22:30 am
Figured it out. Turns out it was completely unrelated -- you really do just need to close and replace the RenderWindow object -- I just had an overlay that wasn't getting reset correctly, thus covering the screen in white.