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

Author Topic: SFML2 View GetRect  (Read 2795 times)

0 Members and 1 Guest are viewing this topic.

m00npirate

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML2 View GetRect
« on: August 10, 2011, 05:00:32 am »
I just recently switched to 2.0 from 1.6. The one thing I am wishing I had still is sf::View's GetRect method. Where did it go?

I was using it to only draw object which collide with the current view.

Edit: Also, it has also always seemed kind of weird to me to set the position based on the center, whereas other rectangle-like objects are usually specified by their upper left corner. This makes me have to add factors of the view's half size all over the place.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML2 View GetRect
« Reply #1 on: August 10, 2011, 07:48:26 am »
Quote
I just recently switched to 2.0 from 1.6. The one thing I am wishing I had still is sf::View's GetRect method. Where did it go?

It's not possible anymore because views can now be rotated. But if you have no rotation you can easily recompute the rectangle from the position and size.

Quote
Also, it has also always seemed kind of weird to me to set the position based on the center, whereas other rectangle-like objects are usually specified by their upper left corner. This makes me have to add factors of the view's half size all over the place.

A view is centered on its... center. If you change its size (zoom in/out), the point that will not move is the center. If the origin was the top-left corner, views would be totally different.
Laurent Gomila - SFML developer

m00npirate

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML2 View GetRect
« Reply #2 on: August 11, 2011, 02:48:19 am »
Ah ok, this does make sense then.

cheers

 

anything