SFML community forums

Help => Graphics => Topic started by: Munchor on July 24, 2013, 08:09:41 pm

Title: Rotating sprite around center
Post by: Munchor on July 24, 2013, 08:09:41 pm
Hi,

I want to rotate my sprite around its center but I want it to be drawn with its origin as (0, 0). So I have this:

Code: [Select]
  setOrigin(texture.getSize().x / 2, texture.getSize().y / 2);
  rotate(-90);
  setOrigin(0, 0);

However, it does not seem to be working - the sprite is rotated exactly the same way as if I didn't have that first line. Any idea of what I'm doing wrong? I understand this might not be possible hence I'm posting here in the forums.
Title: Re: Rotating sprite around center
Post by: Nexus on July 24, 2013, 08:30:28 pm
For sf::Transformable, the transforms are applied in a fixed order at rendering time -- the order of function calls is irrelevant.

If you need more flexibility, directly use the low-level API with sf::Transform.