Add attribute-type and other changes
This commit is contained in:
@@ -44,36 +44,20 @@
|
|||||||
(u/calls! object# ~@options)))
|
(u/calls! object# ~@options)))
|
||||||
|
|
||||||
(defmacro model-batch!
|
(defmacro model-batch!
|
||||||
"Calls a single method on an `model-batch`"
|
"Calls a single method on a `model-batch`"
|
||||||
[screen k & options]
|
[screen k & options]
|
||||||
`(let [^ModelBatch object# (u/get-obj ~screen :renderer)]
|
`(let [^ModelBatch object# (u/get-obj ~screen :renderer)]
|
||||||
(u/call! object# ~k ~@options)))
|
(u/call! object# ~k ~@options)))
|
||||||
|
|
||||||
; model
|
; model
|
||||||
|
|
||||||
(defn model*
|
|
||||||
"The function version of `model`"
|
|
||||||
([a1]
|
|
||||||
(u/create-entity (ModelInstance. (if (map? a1) (:object a1) a1))))
|
|
||||||
([a1 a2]
|
|
||||||
(u/create-entity (ModelInstance. a1 a2)))
|
|
||||||
([a1 a2 a3]
|
|
||||||
(u/create-entity (ModelInstance. a1 a2 a3)))
|
|
||||||
([a1 a2 a3 a4]
|
|
||||||
(u/create-entity (ModelInstance. a1 a2 a3 a4)))
|
|
||||||
([a1 a2 a3 a4 a5]
|
|
||||||
(u/create-entity (ModelInstance. a1 a2 a3 a4 a5)))
|
|
||||||
([a1 a2 a3 a4 a5 a6]
|
|
||||||
(u/create-entity (ModelInstance. a1 a2 a3 a4 a5 a6))))
|
|
||||||
|
|
||||||
(defmacro model
|
(defmacro model
|
||||||
"Returns an entity based on [ModelInstance](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/ModelInstance.html)"
|
"Returns an entity based on [ModelInstance](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/ModelInstance.html)"
|
||||||
[& options]
|
[& args]
|
||||||
`(let [^ModelInstance object# (model*)]
|
`(ModelInstance. ~@args))
|
||||||
(u/calls! object# ~@options)))
|
|
||||||
|
|
||||||
(defmacro model!
|
(defmacro model!
|
||||||
"Calls a single method on an `model`"
|
"Calls a single method on a `model`"
|
||||||
[entity k & options]
|
[entity k & options]
|
||||||
`(let [^ModelInstance object# (u/get-obj ~entity :object)]
|
`(let [^ModelInstance object# (u/get-obj ~entity :object)]
|
||||||
(u/call! object# ~k ~@options)))
|
(u/call! object# ~k ~@options)))
|
||||||
@@ -94,10 +78,9 @@
|
|||||||
(u/calls! object# ~@options)))
|
(u/calls! object# ~@options)))
|
||||||
|
|
||||||
(defmacro model-builder!
|
(defmacro model-builder!
|
||||||
"Calls a single method on an `model-builder`"
|
"Calls a single method on a `model-builder`"
|
||||||
[object k & options]
|
[object k & options]
|
||||||
`(let [^ModelBuilder object# object]
|
`(u/call! ^ModelBuilder ~object ~k ~@options))
|
||||||
(u/call! object# ~k ~@options)))
|
|
||||||
|
|
||||||
; material
|
; material
|
||||||
|
|
||||||
@@ -109,33 +92,44 @@
|
|||||||
`(Material. ~@args))
|
`(Material. ~@args))
|
||||||
|
|
||||||
(defmacro material!
|
(defmacro material!
|
||||||
"Calls a single method on an `material`"
|
"Calls a single method on a `material`"
|
||||||
[object k & options]
|
[object k & options]
|
||||||
`(let [^Material object# object]
|
`(u/call! ^Material ~object ~k ~@options))
|
||||||
(u/call! object# ~k ~@options)))
|
|
||||||
|
|
||||||
; attribute
|
; attribute
|
||||||
|
|
||||||
(defmacro ^:private attribute-type
|
(defmacro ^:private attribute-init
|
||||||
"Internal use only"
|
"Internal use only"
|
||||||
[k]
|
[k]
|
||||||
`(symbol (str u/main-package ".graphics.g3d."
|
`(symbol (str u/main-package ".graphics.g3d.attributes."
|
||||||
(u/key->pascal ~k) "Attribute")))
|
(u/key->pascal ~k) "Attribute.")))
|
||||||
|
|
||||||
(defmacro attribute
|
(defmacro attribute
|
||||||
"Returns a subclass of [Attribute](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/Attribute.html)
|
"Returns a subclass of [Attribute](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/Attribute.html)
|
||||||
|
|
||||||
(attribute :color)"
|
(attribute :color (attribute-type :color :diffuse) (color :blue))"
|
||||||
[type & args]
|
[type & args]
|
||||||
`(~(attribute-type type) ~@args))
|
`(~(attribute-init type) ~@args))
|
||||||
|
|
||||||
|
(defmacro attribute-type
|
||||||
|
"Returns a static field in a subclass of [Attribute](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/Attribute.html)
|
||||||
|
|
||||||
|
(attribute-type :color :diffuse)"
|
||||||
|
[type k]
|
||||||
|
`(u/static-pascal :graphics
|
||||||
|
:g3d
|
||||||
|
:attributes
|
||||||
|
~(str (u/key->pascal type) "Attribute")
|
||||||
|
~k))
|
||||||
|
|
||||||
(defmacro attribute!
|
(defmacro attribute!
|
||||||
"Calls a single method on [Attribute](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/Attribute.html)
|
"Calls a single method on a subclass of [Attribute](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/Attribute.html)
|
||||||
|
|
||||||
(attribute! :color)"
|
(attribute! :color :create-diffuse (color :blue)"
|
||||||
[type k & options]
|
[type k & options]
|
||||||
`((u/static-camel :graphics
|
`((u/static-camel :graphics
|
||||||
:g2d
|
:g3d
|
||||||
(str (u/key->pascal type) "Attribute")
|
:attributes
|
||||||
k)
|
~(str (u/key->pascal type) "Attribute")
|
||||||
|
~k)
|
||||||
~@options))
|
~@options))
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ based on the file at `path`
|
|||||||
|
|
||||||
(align :center)"
|
(align :center)"
|
||||||
[k]
|
[k]
|
||||||
`(u/static-lower :scenes :scene2d :utils :Align ~k))
|
`(u/static-camel :scenes :scene2d :utils :Align ~k))
|
||||||
|
|
||||||
(defn cell!
|
(defn cell!
|
||||||
"Calls a single method on a [Cell](https://github.com/libgdx/libgdx/blob/master/gdx/src/com/esotericsoftware/tablelayout/Cell.java)
|
"Calls a single method on a [Cell](https://github.com/libgdx/libgdx/blob/master/gdx/src/com/esotericsoftware/tablelayout/Cell.java)
|
||||||
|
|||||||
@@ -70,18 +70,24 @@
|
|||||||
[k-list ^String divider ^String str-name]
|
[k-list ^String divider ^String str-name]
|
||||||
(symbol (str main-package "." (join-keys k-list) divider str-name)))
|
(symbol (str main-package "." (join-keys k-list) divider str-name)))
|
||||||
|
|
||||||
(defmacro static-camel
|
|
||||||
"Returns a fully-qualified static method or field whose last item is formatted
|
|
||||||
in camel case"
|
|
||||||
[& args]
|
|
||||||
`~(static-symbol (butlast args) "/" (key->camel (last args))))
|
|
||||||
|
|
||||||
(defmacro static-upper
|
(defmacro static-upper
|
||||||
"Returns a fully-qualified static method or field whose last item is formatted
|
"Returns a fully-qualified static method or field whose last item is formatted
|
||||||
in upper case"
|
in upper case"
|
||||||
[& args]
|
[& args]
|
||||||
`~(static-symbol (butlast args) "/" (key->upper (last args))))
|
`~(static-symbol (butlast args) "/" (key->upper (last args))))
|
||||||
|
|
||||||
|
(defmacro static-pascal
|
||||||
|
"Returns a fully-qualified static method or field whose last item is formatted
|
||||||
|
in pascal case"
|
||||||
|
[& args]
|
||||||
|
`~(static-symbol (butlast args) "/" (key->pascal (last args))))
|
||||||
|
|
||||||
|
(defmacro static-camel
|
||||||
|
"Returns a fully-qualified static method or field whose last item is formatted
|
||||||
|
in camel case"
|
||||||
|
[& args]
|
||||||
|
`~(static-symbol (butlast args) "/" (key->camel (last args))))
|
||||||
|
|
||||||
(defmacro static-class
|
(defmacro static-class
|
||||||
"Returns a fully-qualified static class whose last item is formatted in
|
"Returns a fully-qualified static class whose last item is formatted in
|
||||||
pascal case"
|
pascal case"
|
||||||
@@ -100,7 +106,7 @@ pascal case"
|
|||||||
(scaling :stretch-x)
|
(scaling :stretch-x)
|
||||||
(scaling :stretch-y)"
|
(scaling :stretch-y)"
|
||||||
[k]
|
[k]
|
||||||
`(static-lower :utils :Scaling ~k))
|
`(static-camcel :utils :Scaling ~k))
|
||||||
|
|
||||||
; java interop
|
; java interop
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user