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

Author Topic: sf::View problem  (Read 1305 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
sf::View problem
« on: October 22, 2011, 03:28:56 pm »
Another topic...can you tell we're busy in development? :D

I'm trying to use the sf::View to rotate what's drawn on the target. Here's my code:

Code: [Select]

window1View.Reset(sf::FloatRect(0,0,scrH,scrW));
window1View.SetViewport(sf::FloatRect(0,0,1,1));
window1View.SetCenter((FLOAT)(scrW/2),(FLOAT)(scrH/2));
window1View.Rotate(scrOrt);
window1.SetView(window1View);


The view is correctly rotated to the angle I pass to Rotate, but for some reason everything is drawn too big. Why would this be?

Thanks
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::View problem
« Reply #1 on: October 22, 2011, 03:35:31 pm »
scrH and scrW are swapped in the first line.

And SetCenter is useless here, the center of the view is already located at the center of the rectangle that you passed to Reset.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
sf::View problem
« Reply #2 on: October 22, 2011, 03:50:51 pm »
Ahh! Damn it, should have spotted that.

Thanks Laurent, much appreciated :)
SFML 2.1