[SDL] Odd update problem

Nick Whitelegg bssnrw at bath.ac.uk
Thu Jan 9 15:57:02 PST 2003


I'm having an odd update problem with SDL, wrapped via my library ZXLIB.

As an example ZXLIB program I'm developing a somewhat-Pacman-like game in
which you play a professor who has to avoid the bunsen burners and build
his robot (based on an old Spectrum game). On each game cycle I do the
following with the professor and bunsen burner sprites:

- blank out the previous position, by restoring the background
- redraw the sprite image
- update the sprite rectangles, if each sprite moved

It *normally* works fine. However if two sprites overlap (e.g. two bunsen
burners next to each other chasing the professor down the same passage),
the restoration of the background doesn't happen under them and they leave
a trail.

I've double checked my code and it isn't anything obvious. I can only
assume it's something subtle to do with updating, something I have to be
honest consider a bit of a black box and don't understand fully. (if you
blit an image to screen memory, why do you have to update the screen? This
was not necessary under simpler setups such as MSDOS or 80s micros
graphics mode).


More information about the SDL mailing list