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

Author Topic: Keeping the renderization proportional when renderizing  (Read 1975 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Keeping the renderization proportional when renderizing
« on: February 07, 2011, 05:40:31 am »
Hello, i am using SFML2, and when i resize my window my things get heavily damaged!

I don't remember the right steps to this, even tough i think i did it before!

i've tried setting the Ortho manually, tried to update the view size and viewport. what should i do?

To illustrate the problem better: I have a custom mouse pointer, when i create the window, per say, 500 width, the mouse 0 is window real 0, and the mouse 500 is the window real 500. After resizing, my system cursor can be in 500, and the custom cursor will be in like half of the window, like the view is compacted in there.

Thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Keeping the renderization proportional when renderizing
« Reply #1 on: February 07, 2011, 07:40:44 am »
You must adjust the size of the view when your window is resized.

Something like this:
Code: [Select]
if (event.Type == sf::Event::Resized)
    window.GetDefaultView().Reset(sf::FloatRect(0, 0, event.Size.Width, event.Size.Height));
Laurent Gomila - SFML developer

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Keeping the renderization proportional when renderizing
« Reply #2 on: February 07, 2011, 03:48:35 pm »
Oh Thanks, it worked.

 I knew i had to do this, but i was calling GetView instead of GetDefaultView :)

 

anything