Improve shape documentation
This commit is contained in:
@@ -175,9 +175,8 @@
|
|||||||
"SelectBox" {"select-box" :methods
|
"SelectBox" {"select-box" :methods
|
||||||
"select-box!" :methods}
|
"select-box!" :methods}
|
||||||
"SelectBox.SelectBoxStyle" {"style :select-box" :constructors}
|
"SelectBox.SelectBoxStyle" {"style :select-box" :constructors}
|
||||||
"ShapeRenderer" {"shape!" :methods
|
"ShapeRenderer" {"shape" :methods
|
||||||
"render-shapes!" :methods}
|
"shape!" :methods}
|
||||||
"ShapeRenderer.ShapeType" {"shape-type" :static-fields}
|
|
||||||
"Skin" {"skin" :methods
|
"Skin" {"skin" :methods
|
||||||
"skin!" :methods}
|
"skin!" :methods}
|
||||||
"SkinLoader" {"loader :skin" :methods
|
"SkinLoader" {"loader :skin" :methods
|
||||||
|
|||||||
@@ -14,10 +14,7 @@
|
|||||||
[object k & options]
|
[object k & options]
|
||||||
`(u/call! ^Pixmap ~object ~k ~@options))
|
`(u/call! ^Pixmap ~object ~k ~@options))
|
||||||
|
|
||||||
(defmacro shape-type
|
(defmacro shape-type*
|
||||||
"Returns a static field from [ShapeRenderer.ShapeType](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.ShapeType.html).
|
|
||||||
|
|
||||||
(shape-type :filled)"
|
|
||||||
[k]
|
[k]
|
||||||
`~(u/gdx-field :graphics :glutils "ShapeRenderer$ShapeType" (u/key->pascal k)))
|
`~(u/gdx-field :graphics :glutils "ShapeRenderer$ShapeType" (u/key->pascal k)))
|
||||||
|
|
||||||
@@ -30,14 +27,21 @@
|
|||||||
(defmacro shape
|
(defmacro shape
|
||||||
"Returns an entity based on [ShapeRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html).
|
"Returns an entity based on [ShapeRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html).
|
||||||
|
|
||||||
(shape :filled)"
|
; create a red rectangle
|
||||||
|
(shape :filled
|
||||||
|
:set-color (color :red)
|
||||||
|
:rect 0 0 10 30)
|
||||||
|
; create an empty shape, then set it to a green rectangle
|
||||||
|
(shape (shape :filled)
|
||||||
|
:set-color (color :green)
|
||||||
|
:rect 0 0 10 30)"
|
||||||
[type & options]
|
[type & options]
|
||||||
(when (seq (clojure.set/intersection #{:begin :end} (set options)))
|
(when (seq (clojure.set/intersection #{:begin :end} (set options)))
|
||||||
(-> "No need to call :begin or :end, because it's done for you."
|
(-> "No need to call :begin or :end, because it's done for you."
|
||||||
Throwable.
|
Throwable.
|
||||||
throw))
|
throw))
|
||||||
`(let [entity# ~(if (keyword? type)
|
`(let [entity# ~(if (keyword? type)
|
||||||
`(assoc (shape*) :type (shape-type ~type))
|
`(assoc (shape*) :type (shape-type* ~type))
|
||||||
type)
|
type)
|
||||||
^ShapeRenderer object# (u/get-obj entity# :object)]
|
^ShapeRenderer object# (u/get-obj entity# :object)]
|
||||||
(assoc entity# :draw! (fn [] (u/calls! object# ~@options)))))
|
(assoc entity# :draw! (fn [] (u/calls! object# ~@options)))))
|
||||||
|
|||||||
Reference in New Issue
Block a user