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

Author Topic: [SOLVED]How can I scale window while keeping view's original aspect ratio?  (Read 5757 times)

0 Members and 1 Guest are viewing this topic.

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
My original screen size is 256x240 and it scales nicely when the window has the same aspect ratio(512x480, for example)

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)

What I want to have is this:

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.
« Last Edit: September 09, 2014, 07:46:08 pm by moarthenfeeling »
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

G.

  • Hero Member
  • *****
  • Posts: 1554
    • View Profile

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re: How can I scale window while keeping view's original aspect ratio?
« Reply #2 on: September 09, 2014, 07:45:13 pm »
Thanks a lot, totally what I was looking for!  ;)
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log