sdl@lists.libsdl.org
[Top] [All Lists]

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

Subject: Re: [SDL] Question about animation; erasing where my sprite has been
From: "clemens kirchgatterer"
Date: Wed, 5 Mar 2008 09:42:19 +0100
On Mon, Mar 3, 2008 at 11:09 PM, Edward Cullen <eac203@xxxxxxxxxxxxxxx> wrote:

>  1. Draw the background once.
>
>  2. Decide where you are going to draw your sprite (do collision
>  detection etc.)
>  3. Save the portion of the background where you are going to put the
>  sprite into memory associated with the sprite (so that you can restore
>  it later).
>  4. Draw the sprite.
>  5. Remove the sprite by re-drawing the background from the backup.
>  6. Goto 2.

i don't think this will work very well. 1st, overlapping sprites
require even more constrains (order of storing backups and redrawing).
2nd, additional surfaces are required for the backups. 3rd, there is a
blit overhead for saving the background.

IMHO the best aproach is to just rebuild the screen within the changed
regions (use SetClipRect with one or more dirty rects) from the
surfaces you already have anyway (background and sprite surfaces).

hope this helps ...
clemens
_______________________________________________
SDL mailing list
SDL@xxxxxxxxxxxxxxxx
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

<Prev in Thread] Current Thread [Next in Thread>