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

Author Topic: A simple one- accessors for FlipX and FlipY in sf::Sprite  (Read 24016 times)

0 Members and 2 Guests are viewing this topic.

quasius

  • Full Member
  • ***
  • Posts: 166
    • View Profile
A simple one- accessors for FlipX and FlipY in sf::Sprite
« on: June 12, 2008, 01:39:10 am »
The subject line pretty much says it all.  There don't appear to be any accessors for the FlipX and FlipY variables in sf::Sprites, only set functions.  This is probably an oversight, but they should be there IMO.  I needed them and added them myself, but I thought I'd mention it here.

jbadams

  • Newbie
  • *
  • Posts: 12
    • View Profile
A simple one- accessors for FlipX and FlipY in sf::Sprite
« Reply #1 on: June 18, 2008, 12:23:33 pm »
FlipX and FlipY are member functions which flip the sprite along the specified axis, not variables, and thus there aren't accessors or mutators -- what is it that you're actually returning from the accessors you say you've added, the value of the myIsFlippedX and myIsFlippedY private members?

jbadams

  • Newbie
  • *
  • Posts: 12
    • View Profile
A simple one- accessors for FlipX and FlipY in sf::Sprite
« Reply #2 on: June 18, 2008, 12:24:39 pm »
It just occured to me that you might be using a binding which implements this in a different way, or perhaps there are changes in the latest version available from SVN?  If either of these are the case feel free to ignore me.

quasius

  • Full Member
  • ***
  • Posts: 166
    • View Profile
A simple one- accessors for FlipX and FlipY in sf::Sprite
« Reply #3 on: June 23, 2008, 06:06:08 pm »
Quote from: "jbadams"
FlipX and FlipY are member functions which flip the sprite along the specified axis, not variables, and thus there aren't accessors or mutators -- what is it that you're actually returning from the accessors you say you've added, the value of the myIsFlippedX and myIsFlippedY private members?


I know FlipX and FlipY are member functions.  Specifically, they are mutators for the variable myIsFlippedX myIsFlippedY.
So the GetFlipX and GetFlipY functions I made simply return myIsFlippedX and myIsFlippedY.  I see no good reason why you should not be able to read back that information in the same way that you read rotation and scale.  In my case, I needed it for copying the attributes of one sprite to another in my map editor.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
A simple one- accessors for FlipX and FlipY in sf::Sprite
« Reply #4 on: January 08, 2009, 08:33:25 pm »
I needed it to.
When changing the sprite center I need to flip the new center point if the sprite is flipped.
Pluma - Plug-in Management Framework

wilbefast

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • http://wilbefast.com
A simple one- accessors for FlipX and FlipY in sf::Sprite
« Reply #5 on: October 14, 2010, 10:48:01 pm »
Bump. The attribute is called: "private bool myIsFlippedX", and I'm fairly certain it's an oversight  :?

Please add a bool GetIsFlippedX() getter!!!

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
A simple one- accessors for FlipX and FlipY in sf::Sprite
« Reply #6 on: October 15, 2010, 10:14:46 am »
I'm more concerned that flip is implemented for all Drawables in general  :lol: (flip over center, not cheap image flipping)

That isFlipped getter may be useful but not sure if it's really necessary. You can always keep your own boolean. It's not very nice to derive Sprite to duplicate members or replace functionality, but it's a bit like what I do with flips on my InversibleDrawable class
Pluma - Plug-in Management Framework

 

anything