SFML community forums

Help => Window => Topic started by: Elias Daler on September 09, 2014, 06:40:51 pm

Title: [SOLVED]How can I scale window while keeping view's original aspect ratio?
Post by: Elias Daler on September 09, 2014, 06:40:51 pm
My original screen size is 256x240 and it scales nicely when the window has the same aspect ratio(512x480, for example)
(http://i.imgur.com/AR9aSdQ.png)
But when I change window size to 640x480, it scales pretty badly(notice that text doesn't scale at all, which is another problem connected to this because it scales when window is resized during runtime)
(http://i.imgur.com/1DE9VNn.png)
What I want to have is this:
(http://i.imgur.com/mPKAtXW.png)

How can I achieve this? I realize that this has something to do with sf::View's setViewport() function, but I can't figure out how to use it.
Title: Re: How can I scale window while keeping view's original aspect ratio?
Post by: G. on September 09, 2014, 07:07:08 pm
http://en.sfml-dev.org/forums/index.php?topic=15802
Take a look at this thread ;)
Title: Re: How can I scale window while keeping view's original aspect ratio?
Post by: Elias Daler on September 09, 2014, 07:45:13 pm
Thanks a lot, totally what I was looking for!  ;)