[SDL] W2K Chinese Input Method?

Arlo Liu arlo at mycorner.com.tw
Mon Aug 20 21:46:02 PDT 2001


On Wednesday 08 August 2001 11:59, Mark Collins wrote:
> Quick and nasty:
>
> XOR the sprites (without  background) then memcmp the images.
>
> If there's a change, there's been a collision, otherwise, no.

Note: This would assume that the transparent areas have a pixel value of
      zero. (Black, if it's on RGB format, index 0 if it's an 8 bit
      indexed color format.)

Now, if that's to much brute force for you (ie if you need to do *lots* 
of collission detection every frame), you could create "collision maps" 
for the sprites, with only one bit per pixel. The most complicated part 
of that is probably getting the shifting right. (IIRC, SGE does this, so 
you can just use that if you don't feel like reimplementing it  yourself. 
It could be a good excercise coding it, though. :-)


//David Olofson --- Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david at linuxdj.com -'




More information about the SDL mailing list