SFML community forums

Help => Window => Topic started by: mcassimus on October 26, 2017, 08:40:42 pm

Title: View -> Fullscreen Window. How to apply empty margin?
Post by: mcassimus on October 26, 2017, 08:40:42 pm
I have a view defined as
sf::View view(sf::Rect<float>(0, 0, 310, 248));

I am then applying it to a window defined as
 sf::RenderWindow window(sf::Videomode::getFullscreenModes().at(0), "Space Invaders", sf::Style::Fullscreen);

I am trying to apply the view to any monitor of any aspect ratio and would like to keep the dimensions of the view and add void space around the view as needed. it works for any monitor with the aspect ratio of 5:4, which isnt even too common anymore. I am unable to figure out how to use view.setViewport(...); correctly to apply this empty space to fill the screen to keep the appropriate aspect ratio of the view. What would be the best way to center the view onto the window while blowing up the view as large as possible using whatever void space necessary?
Title: Re: View -> Fullscreen Window. How to apply empty margin?
Post by: fallahn on October 27, 2017, 12:16:20 am
This wiki entry should point you in the right direction:
https://github.com/SFML/SFML/wiki/Source%3A-Letterbox-effect-using-a-view
Title: Re: View -> Fullscreen Window. How to apply empty margin?
Post by: mcassimus on October 27, 2017, 09:54:51 pm
Thank you very much, this resource helped a ton.

Now, is there a way to get the rotation of the display resolution through sfml or would that have to be something that needs to be retrieved through another resource?