CLIPMUNK provides Common Lisp CFFI bindings for the
Chipmunk Physics library. It began as a fork of
Ralith's cl-chipmunk library, but after a while I got
tired of writing the defcfun
s by hand and switched to using
SWIG to generate the bindings automatically.
TBA
Some of the functions in the Chipmunk API depend on getting
struct arguments passed by value, but this is not possible with
CFFI. There is a workaround for this, however: we can pass
each element in the struct as a separate argument to the function, as
long as they are passed in the correct order. Since the most
frequently used struct (cpVect
) is a fairly simple one, consisting
of just two double floats, it is quite easy to adjust the generated
bindings to accomodate this.
This approach seems to work nicely, at least on x86-based platforms.
CLIPMUNK is being developed and tested on SBCL running on Linux and OSX.