[SDL] quick flip an image

David Olofson david at olofson.net
Tue Dec 28 19:04:10 PST 2004


On Wednesday 29 December 2004 03.55, Austin W. Dunham V wrote:
> SDL doesn't have it, but there's no reason you can't code it.
> I've already looked at what it takes to program an "old school",
> with really no realtime lighting mario style sidescroller where
> mirroring and 90 degree rotations are handy...and what I've decided
> to do is have one image stored, and have the program, at startup,
> do all the rotations and transformations and "expand" the image for
> me. (Left/Right for 4 "norths", up, down, left, and right is 8
> images from one.)
>
> You do it programatically so left is always the same number for
> every image, and there you have it.  With just a *little* more
> coding you save on diskspace, and you get the fast blitting of a
> static image.
>
> Not what you were looking for, but not too nasty to implement. 
> Maybe a little memory wasteful, but that's the end users's system
> that has to worry about it, not your bandwidth...

Memory shouldn't be an issue, unless you have loads of graphics and/or 
want smooth rotation of objects rather than just mirroring or 90° 
turns.

Either way, when working on this level, it's relatively easy to make 
the code scalable all the way from load time rotation into 8 
frames/sprite (the original Kobo Deluxe graphics, which I'm still 
using, only uses 8 frames per rotation BTW) via lots of frames (say 
256/rotation) through real time rotation directly to the screen.

This should mix well with an extended SDL 1.3 API, with "worst case" 
fallbacks still usable for load time prerendering and OpenGL or 
Direct3D rendering in the high end of the spectra.


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---




More information about the SDL mailing list