Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext ThreadShow in Flat Mode*

SubjectRe: More assembly fun! Reply to this message
Posted byBart T.
Posted on11/06/03 07:48 PM

> 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.


Entire Thread
Subject  Posted byPosted On
*More assembly fun!  Snowball 211/06/03 06:52 PM
.*Re: More assembly fun!  galibert11/07/03 03:59 AM
..Re: More assembly fun!  Bart T.11/06/03 07:48 PM
..*Excellent idea  Snowball 211/07/03 00:35 AM
...*Re: Excellent idea  Bart T.11/07/03 01:08 AM