|
> 1.Draw the background to screen buffer > 2.Draw the sprite over it > 3.Transfer screen buffer to video memory for output
Sounds good.
> Now here comes the tricky part for me. As the sprite moves around my background > I don't want to constantly redraw the entire image. I just want it to redraw > the sprite and just the portion of the background that it moves over. Or is > there another easier way to avoid having to redraw what the sprite moves over?
On one hand, people will tell you that today's machines are fast enough that redrawing the entire scene shouldn't be a concern, but IMHO, it's good that you're trying to optimize this, because it would be an issue on very old hardware.
I actually did the same thing once. You can have your sprite object defined as 2 bitmaps: The actual sprite and a "background save" buffer.
Each time you move the sprite, draw the background save buffer as a solid, non-transparent sprite (basically, copy it directly) at the position where the sprite is currently at (to erase it.) Next, copy the background where your sprite will move to and then draw the sprite.
---- Bart
|