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

Author Topic: [Request] sf::Sprite Flip Methods  (Read 3854 times)

0 Members and 1 Guest are viewing this topic.

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
[Request] sf::Sprite Flip Methods
« on: March 21, 2011, 11:43:59 pm »
Hello everyone,

After using SFML for a while now I realized the sf::Sprite::FlipX and FlipY doesn't really fit in with the rest of the sprite class. All of the other methods are mainly Get and Set. I think we should do a SetFlipX, SetFlipY, SetFlip (X + Y). Also add a GetFlipX and GetFlipY.

Also I don't know if this would be something else to add but when you flip a image also flip the origin with it. Maybe make that another method,,, I don't know lol
CoderZilla - Everything Programming

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
[Request] sf::Sprite Flip Methods
« Reply #1 on: March 22, 2011, 01:08:29 pm »
I don't think they should be renamed to Set* and Get*. Compared to stuff like SetColor or SetPosition, FlipX/Y are operations and don't give access to properties (i.e. you "do" the flip, you don't set it).

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: [Request] sf::Sprite Flip Methods
« Reply #2 on: March 22, 2011, 05:28:33 pm »
Quote from: "coolhome"
Also I don't know if this would be something else to add but when you flip a image also flip the origin with it. Maybe make that another method,,, I don't know lol
I don't think this is the responsibility of the sprite. On user side, you can achieve this by writing a global function.

Quote from: "Tank"
Compared to stuff like SetColor or SetPosition, FlipX/Y are operations and don't give access to properties (i.e. you "do" the flip, you don't set it).
That's not true. The names "FlipX/Y" are misleading, one might expect nullary functions representing actions. However these functions are setters: They assign the parameter to the internal state, but they do not regard the current state.

In case this should be changed, I propose "SetFlippedX/Y" and "IsFlippedX/Y".
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: