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

Author Topic: Sprite::SetCenter() question  (Read 1947 times)

0 Members and 1 Guest are viewing this topic.

vro

  • Newbie
  • *
  • Posts: 44
    • View Profile
Sprite::SetCenter() question
« on: July 23, 2011, 12:29:53 am »
So I was looking at the sf::Sprite documentation, and I noticed SetCenter is supposed to take two coordinates, Vector2 (T X, T Y).

But I noticed in the game I'm working on, I used:
Code: [Select]

Sprite.SetCenter(Sprite.GetSize() / 2.f)


Which is one argument. So why is this working properly? If SetCenter() only receives one argument does it just use that argument for both x and y?

Probably not a very important question but I am curious :)

JAssange

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Sprite::SetCenter() question
« Reply #1 on: July 23, 2011, 05:57:05 am »
That method (at least in SFML2 where it is renamed SetOrigin) has overloads; you can either call it with a vector or two floats. The result of dividing a VectorT by T is a VectorT so you've satisfied an overload.

vro

  • Newbie
  • *
  • Posts: 44
    • View Profile
Sprite::SetCenter() question
« Reply #2 on: July 23, 2011, 08:58:33 am »
thanks!