SFML community forums

Help => Graphics => Topic started by: M74 on January 22, 2015, 11:40:46 pm

Title: "Cost" of flipping sprites?
Post by: M74 on January 22, 2015, 11:40:46 pm
Hi,

i`ve read the topic of how to flip a sprite: http://en.sfml-dev.org/forums/index.php?topic=7572.0 (http://en.sfml-dev.org/forums/index.php?topic=7572.0)

I was wondering if this is some sort of unperformant if i have to flip a greater amount of sprites and better should provide also pre-flipped versions of my sprites in my Spritesheet(s) or is it negligable to flip/scale sprites?

Please excuse my english.

Regards,
M74
Title: Re: "Cost" of flipping sprites?
Post by: AlexAUT on January 22, 2015, 11:52:40 pm
Drawing the sprite flipped(scale = -1) doesn't affect performance at all. Changing the scale just changes some values in a matrix.


AlexAUT
Title: Re: "Cost" of flipping sprites?
Post by: M74 on January 22, 2015, 11:59:36 pm
Thank you  :)
Title: Re: "Cost" of flipping sprites?
Post by: Jesper Juhl on January 23, 2015, 04:17:38 pm
I have to point out that you could have easily tested this on your own.
Just writing a trivial ~20 line program that draws a sprite flipped or not 1 million times and timed it would answer the question.
A profiler could also answer the question of whether the "flip" operation was expensive or not.
Next time you run into a question like this, maybe spending a little time figuring out the answer yourself is worth-while  ;)