SFML community forums

Help => Graphics => Topic started by: Grimshaw on February 07, 2011, 05:40:31 am

Title: Keeping the renderization proportional when renderizing
Post by: Grimshaw 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
Title: Keeping the renderization proportional when renderizing
Post by: Laurent 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));
Title: Keeping the renderization proportional when renderizing
Post by: Grimshaw 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 :)