[SDL] Question about animation; erasing where my sprite has been

Mason Wheeler masonwheeler at yahoo.com
Sat Mar 1 11:21:46 PST 2008


The simplest solution is to establish a background (either an image or a solid color) and fill the screen with it as the first line of Draw::drawScreen().  Then draw everything else on top of that.

Also, redrawing everything every time something changes position works for very simple games, but if you have several sprites moving at once you'll desync things quickly doing it that way. (Not to mention wasting a ton of cycles.)  A better solution is to use an SDL_Timer to call drawScreen every X number of miliseconds to establish a constant framerate.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080301/c3a98ec0/attachment.htm 


More information about the SDL mailing list