SDL separating sprites

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

SDL separating sprites

Post by Ginto8 »

I've been thinking, and I have some ideas as to how to rotate/flip sprites from a sprite sheet, but I don't have time to test them and I wanted the opinions of you guys. ;)

So that you can flip/rotate individual sprites instead of an entire spritesheet, would it be possible to load the spritesheet, blit the sprite to another surface, and then use the second surface to rotate/flip it?

Thanks in advance.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: SDL separating sprites

Post by MarauderIIC »

You can flip the surface that the sprite is drawn on, yes, by just inverting the glTexCoord2f numbers, I think it is (#include <sdl/opengl.h> iirc), if you're using opengl with your SDL. Pure SDL flip, I'm not sure of.

Rotating an arbitrary degree is a whole 'nother matter.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: SDL separating sprites

Post by Ginto8 »

MarauderIIC wrote:You can rotate the surface that the sprite is drawn on, yes, by just inverting the glTexCoord2f numbers, I think it is (#include <sdl/opengl.h> iirc)
:lol: though I'm not using OGL. But thanks anyway, I know how I'll rotate/flip them, I just wanted to make sure that it was possible to split the sprite/tile sheet into multiple surfaces, then use them. Thanks again! :)

Edit: and the rotation is just going to be by every 90 degrees, so it'll be simple. =P ;)
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Post Reply