Create add-joint! multimethod
This commit is contained in:
@@ -11,6 +11,11 @@
|
|||||||
`basic-body` or a `rigid-body`."
|
`basic-body` or a `rigid-body`."
|
||||||
(fn [screen body] (-> screen (u/get-obj :world) class)))
|
(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!
|
(defmulti body-position!
|
||||||
"Changes the position of the body in `entity`. For 2D physics, the arguments
|
"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."
|
should be x, y, and angle, whereas for 3D physics they should be x, y, and z."
|
||||||
|
|||||||
@@ -103,16 +103,6 @@
|
|||||||
[object k & options]
|
[object k & options]
|
||||||
`(u/call! ^Joint ~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
|
; fixtures
|
||||||
|
|
||||||
(defmacro fixture-def
|
(defmacro fixture-def
|
||||||
@@ -220,6 +210,11 @@
|
|||||||
[screen b-def]
|
[screen b-def]
|
||||||
(box-2d! screen :create-body 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
|
(defmethod c/physics-listeners
|
||||||
World
|
World
|
||||||
[screen
|
[screen
|
||||||
|
|||||||
Reference in New Issue
Block a user