Someone has probably already answered this (I get emails forwarded to me at
work, and I always seem to be behind everyone else…), but anyway
What you want to do is save the area of the background where the sprite will
be blitted before you actually blit the sprite. Then, to erase the sprite,
simply re-blit the saved copy of the background over the sprite. So the
process looks kinda like this:
(assume the sprite will be blitted at X, Y )
- Save copy of the background at X, Y
- Blit sprite at X, Y
To move sprite:
3) Blit saved background at X, Y
4) Adjust X,Y to new sprite location
5) Save background at X,Y
6) Blit sprite at X,Y
And so on…
As far as the SDL FAQ, it’s been discussed many times about a book on SDL or
something. I find the example SDL programs to be quite educational, not to
mention that several members on this mailing list have their SDL projects
listed on the “projects” page. Looking at their source code is a big help
too.
Also, I believe that there is an “unofficial” SDL chat on
irc.openprojects.net in #SDL. I haven’t been over there for quite some
time, but if it’s still up, that’s an excellent way to get help if you need
it right now.
cheers,
Dave “PenguinDude” Archbold> -----Original Message-----
From: G.Gabriele [SMTP:netbone at tiscalinet.it]
Sent: Wednesday, August 09, 2000 10:48 AM
To: sdl at lokigames.com
Subject: [SDL] How to get the size of a blitted surface ?
Hi,
well I’d like to know how to get the size of a blitted image,
(a sprite for example) so I can redraw the erased background.
For example if I have an image blitted onto the screen
over another background surface, if I move the first image
(the sprite) the background is erased…
Well how to redraw it without reblitting the whole screen ?
Thanks in advance.
PS: I think that writing a FAQ paper about SDL programming
wouldn’t be a bad idea… I think question like mine
have been asked a lot of time … 
–
- g.gabriele at europe.com ---------------+
| |
±----------------- think Open Source -+