2008/7/24 Elliott Slaughter <[EMAIL PROTECTED]>:
> I've been working on my game again lately, and one thing I would like to do
> is collision detection. To make collision detection sufficiently accurate, I
> figure I'll need some sort of pixel perfect algorithm, for which I need
> access to the pixels of a surface. Thanks to a previous discussion on this
> mailing list, I already know how to do that, but what I *don't* know is how
> to find the color key of a surface so I can figure out if a pixel is
> transparent or not. There are functions for set-color-key and
> clear-color-key but I don't see any get-color-key, and I'm not really sure
> how to get it, except by saving the argument passed to load-image and
> constructing the color-key manually.
>
> Also, I think I know a reasonably decent algorithm for collision detection,
> but any suggestions on the topic would be appreciated anyways ;-)
>
> Thanks!
>
> P.S. I've been wondering why the keyword arguments to load-image are
> :key-color and :key-color-at instead of :color-key and :color-key-at (not
> that it really matters, it's just a fascinating anomaly).

SDL doesn't have an API for retrieving the color key. You've got three options:

1) Remember the color key when you load the image.
2) Access the colorkey value using cffi. Given a surface pointer,
there is a field format (a SDL_PixelFormat) and inside that is the
colorkey in a field called colorkey. (Uint32).
3) Write, or wait for someone to write, lisp code that does 2) and
submit to lispbuilder.


Justin
_______________________________________________
application-builder mailing list
application-builder@lispniks.com
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to