SFML community forums

Help => Window => Topic started by: ppnl on January 24, 2023, 10:36:03 am

Title: Window behavior.
Post by: ppnl on January 24, 2023, 10:36:03 am
What is the following code suppose to do?

#include <SFML/Graphics.hpp>
using namespace sf;

int main()
{
   VideoMode vm(1920, 1080);
   RenderWindow window(vm, "Test!!!", Style::Fullscreen);

   while(window.isOpen())
   {
      if(Keyboard::isKeyPressed(Keyboard::Escape))
      {
         window.close();
      }

      window.clear();
   }

   return 0;
}
 

My understanding is that it should open a full screen borderless window with a resolution of 1920 by 1080. Instead it opens a smaller borderless window in the upper left corner. It is probably 1920 by 1080 pixels but at the resolution of my desktop which is 3840 by 2160. Some open windows on my desk top are descaled as if they were on a 1920 by 1080 desktop when the program is run.

Is this expected behavior? How do you get a 1920 by 1080 full screen window to open? 
Title: Re: Window behavior.
Post by: eXpl0it3r on January 26, 2023, 08:26:45 am
What OS are you running on?
Title: Re: Window behavior.
Post by: ppnl on January 26, 2023, 11:06:45 am
What OS are you running on?

Thanks but I think I have it sorted. It is an old ugly about how full screen mode works. Turns out that  even deciding  how it should work is complicated. Being new to both object oriented programming and graphics programming made it a real rats nest.