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 - uzimonkey

Pages: [1]
Window / Gracefully degrade resolution
« on: November 01, 2010, 10:36:14 pm »
If I design a game to run at 1280x720 but someone tries to start the game on a lower resolution screen, SFML's behavior is undesirable.  It will open up a window as big as it can (up to the desired resolution), but doesn't preserve aspect ratio.  Is there any way to center the scene in SFML, with black bars on the top and bottom (or left and right, in the case of 4:3 resolutions on a 16:9 screen)?

I tried playing with SetView and sf::View objects, and that kind of works.  The game can still draw outside of the "screen," but that could be fixed by drawing black rects over the portions that are supposed to stay black.  And in windowed mode, you can just set the height of the window to what it should be for the width it gave you.

Of course this wouldn't be ideal.  Scaling down never looks good, but at least it'll work and not be unnaturally stretched.

I was mostly just wondering if there is any supported way to do this, or if anyone has any code that already does this that they'd like to share?

Pages: [1]