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

Author Topic: Sprite Offset different from Center  (Read 3085 times)

0 Members and 1 Guest are viewing this topic.

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
Sprite Offset different from Center
« on: July 29, 2008, 08:21:02 am »
Hi. Is possible to have a sprite offset different from sprite center?

I use sprite.setposition in absolute mode and not in relative
 so at every frame I have to add an offset.

Now I use setcenter for this but if next I have to rotate the sprite what I get?

In alternative there is a mode to set an offset for all sprites or an offset of render window?

Thanks
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sprite Offset different from Center
« Reply #1 on: July 29, 2008, 08:50:23 am »
Quote
Hi. Is possible to have a sprite offset different from sprite center?

Sorry I don't get it. Why can't you just add this offset to your absolute position ?

Quote
In alternative there is a mode to set an offset for all sprites

You can have a container of sprites by simply deriving from sf::Drawable ; you can then see it as a single drawable object with its one translation, rotation, scale on top of the contained sprites properties.

Quote
or an offset of render window?

Use sf::View.
Laurent Gomila - SFML developer

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
Sprite Offset different from Center
« Reply #2 on: July 29, 2008, 09:30:18 am »
1000 Thanks Laurent, I'll go to try sf::View that can be a good solution for my application that at the end need 2 similar view in one window. bye-bye
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)