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 8765 times)

0 Members and 1 Guest are viewing this topic.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • 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: November 08, 2023, 04:44:01 pm by Elias Daler »
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

G.

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

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • 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 (abandoned, doing other things) | edw.is | @EliasDaler