Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: C#/SFML.NET -- Change Window Resolution  (Read 2247 times)

0 Members and 1 Guest are viewing this topic.

DigitalBombDev

  • Newbie
  • *
  • Posts: 8
    • View Profile
C#/SFML.NET -- Change Window Resolution
« 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: C#/SFML.NET -- Change Window Resolution
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

DigitalBombDev

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: C#/SFML.NET -- Change Window Resolution
« Reply #2 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.

 

anything