[SDL] Bitmap Colisions function !

Neil Bradley nb at synthcom.com
Sat Jul 27 14:45:00 PDT 2002

> Well partners, I am a newbie here. I enjoy SDL a lot. And I am getting
> start with it now, but I have already good concepts in C/C++ and
> Allegro (before SDL I programed with it) and in SDL too (I read a lot
> of tutorials), so I am not having too much problems. I just want to
> ask you: Is there any done function for check colision among bitmaps
> in a game ? Which one ? Let's suppose I have graphics in 8 bpps. Do
> the number of bits per pixel by any chance changes anything ? Or
> there's a bitmaps colision function for all ways ...; please help me
> !?

There isn't in SDL. The concept of a "collision" is arbitrary, really, and
depends upon how you code your game. In 8bpp surfaces, you might reserve
certain palette entries to be transparent, so as to not cause a collision,
or you may look at the actual color. In 16bpp/24bpp you may look at
anything with an intensity lower than a certain level (or completely
black) as transparent. In 32bpp you may use the alpha channel, or you may

In any case, you'll probably have to write your own or find one that suits
your needs somewhere on the net.


Neil Bradley            What are burger lovers saying
Synthcom Systems, Inc.  about the new BK Back Porch Griller?
ICQ #29402898	        "It tastes like it came off the back porch." - Me

More information about the SDL mailing list