After possibly the shortest turnaround in the history of a git repo. Im archiving these bindings in favor of chipmunk 2d bindings. Turns out Physac was mainly built as an example and not intended for real use.
Janet bindings to Physac. The bindings are faithful to the original C API, especially where it makes sense, but function names have been "lispified" (kebab case, question marks instead of the word "Is", etc.).
Here are some deviations I've made from the core C api.
- GetPhysicsShapeType converts resulting integer to keywords
:circle
and:polygon
respectively. - Although the
get-physics-shape-type
andget-physics-shape-vertices-count
functions are implemented, you can also get this info right off the PhysicsBody through its getter.(get-physics-shape-type (my-physics-body :id)) (get-physics-shape-vertices-count (my-physics-body :id)) (get my-physics-body :shape-type) (get my-physics-body :vertices-count)
- Similary,
set-physics-body-rotation
is implemenented but you can alternatively use aput
on the physics body(set-physics-body-rotation my-physics-body radians) (put my-physics-body :rotation radians)