Add vector macros

This commit is contained in:
oakes
2014-01-15 16:47:23 -05:00
parent 8e46219778
commit e3ea76d4c6
2 changed files with 24 additions and 6 deletions

View File

@@ -1,8 +1,26 @@
(ns play-clj.math
(:import [com.badlogic.gdx.math Vector2 Vector3]))
(defn vector
([x y]
(Vector2. x y))
([x y z]
(Vector3. x y z)))
(defn vector-2*
[x y]
(Vector2. x y))
(defmacro vector-2
[x y & options]
`(u/calls! ^Vector2 (vector-2* ~x ~y) ~@options))
(defmacro vector-2!
[object k & options]
`(u/call! ^Vector2 ~object ~k ~@options))
(defn vector-3*
[x y z]
(Vector3. x y z))
(defmacro vector-3
[x y z & options]
`(u/calls! ^Vector3 (vector-3* ~x ~y ~z) ~@options))
(defmacro vector-3!
[object k & options]
`(u/call! ^Vector3 ~object ~k ~@options))