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

Author Topic: Need to flip "rotate" axis  (Read 1448 times)

0 Members and 1 Guest are viewing this topic.

Chuckleluck

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Need to flip "rotate" axis
« on: November 28, 2011, 06:43:13 pm »
Hello,
I want to make a simple program that allows the user to drive a car.  Pressing "W" would make the car go forward, and pressing A and D would make the car turn left and right, respectively.
Now, to make the car sprite turn realistically, I'm using the Rotate function.  This works fine for turning left (counterclockwise), as the axis on which the sprite turns is at 0, 0, and thus the top left corner.  However, for turning right, the car goes in reverse (clockwise).  I need a way to change the axis on which the car rotates, from 0, 0 to 46, 0 (which happens to be the rightmost pixel coordinate on my sprite image).
Is there a function I can use to change the axis on which Sprite.Rotate() rotates on?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Need to flip "rotate" axis
« Reply #1 on: November 28, 2011, 07:32:18 pm »
There's sprite.SetCenter, but it also controls the origin for the translation (position) and scale. So you'll have to adjust them accordingly.
Laurent Gomila - SFML developer

 

anything