[SDL] Best way to rotate a sprite?

Tane Piper tane.piper at ukonline.co.uk
Sun Jan 26 10:30:01 PST 2003


Hey everyone,

At the moment, I am using a rather dodgy control method in my game where the direction button changes the sprite on screen to face that direction,  but each direction has its own bitmap:

Up button loads bitmap 0,
Right button load bitmap 1, etc.

What I want to do is change this so there is only one bitmap needed for the sprite and the buttons rotate the sprite, or make it go backwards or forwards along the angle it's facing - the same control system used in the original Grand Theft Auto.  I don't see anything in the SDL docs that directly allow you to control the rotation of a SDL_surface (and from this I can do the forward and backward motion along the vector of the sprite direction).  Is there any libraries that allow you to do this directly to the surface, or can anybody help with code for this problem?

Thanks,
Tane Piper: http://tane.cream.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030126/3f494bf3/attachment.htm>


More information about the SDL mailing list