Create add-joint! multimethod

This commit is contained in:
oakes
2014-04-16 17:15:28 -04:00
parent 010c7d2a4e
commit 82a4508cff
2 changed files with 10 additions and 10 deletions

View File

@@ -11,6 +11,11 @@
`basic-body` or a `rigid-body`."
(fn [screen body] (-> screen (u/get-obj :world) class)))
(defmulti add-joint!
"Adds the `joint` to the `screen` for physics simulations and returns it. For
2D physics, `joint` should be a `joint-def`."
(fn [screen joint] (-> screen (u/get-obj :world) class)))
(defmulti body-position!
"Changes the position of the body in `entity`. For 2D physics, the arguments
should be x, y, and angle, whereas for 3D physics they should be x, y, and z."

View File

@@ -103,16 +103,6 @@
[object k & options]
`(u/call! ^Joint ~object ~k ~@options))
(defn create-joint!*
[screen j-def]
(box-2d! screen :create-joint j-def))
(defmacro create-joint!
"Returns a [Joint](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/physics/box2d/Joint.html)."
[screen j-def & options]
`(let [object# (create-joint!* ~screen ~j-def)]
(u/calls! object# ~@options)))
; fixtures
(defmacro fixture-def
@@ -220,6 +210,11 @@
[screen b-def]
(box-2d! screen :create-body b-def))
(defmethod c/add-joint!
World
[screen j-def]
(box-2d! screen :create-joint j-def))
(defmethod c/physics-listeners
World
[screen