[SDL] Rotating sprites

Bob Pendleton bob at pendleton.com
Mon Sep 23 18:34:01 PDT 2002

Alan Wolfe wrote:
> Rotating each pixel is alot of work to do each frame, but you could always
> rotate it at the begining and store the rotated pictures in memory.

There is a very old article at  http://gameprogrammer.com/5-poly.html
IIRC it details how to draw a polygon and how to draw a rotated 2d 
textured polygon. Which is all you need to rotate an image on the fly.
The code is so old that it is all written using fixed point arithmetic.

Even though I wrote the article, it has been 9 years since I looked at 
but you might find both the article and the code to be of value. I 
really ought to get that old code working with SDL. The code was derived 
from code written for a commercial game that was intended to run on a 
33Mhz 486sx and do rotations every frame. Sadly, the game was canceled 
at about the 80% complete phase.

		Bob Pendleton

+ Bob Pendleton, consultant for hire +
+ Resume: http://www.jump.net/~bobp  +
+ Email:  bob at pendleton.com          +

More information about the SDL mailing list