Page 1 of 1

SDL separating sprites

Posted: Thu Feb 19, 2009 8:09 pm
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.

Re: SDL separating sprites

Posted: Thu Feb 19, 2009 8:11 pm
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.

Re: SDL separating sprites

Posted: Thu Feb 19, 2009 8:13 pm
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 ;)