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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mcassimus

Pages: [1]
1
Window / View -> Fullscreen Window. How to apply empty margin?
« 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?

Pages: [1]