Add pixmap-format and a new arity to pixmap*

This commit is contained in:
oakes
2014-09-26 23:56:34 -04:00
parent f10639ed99
commit 5d90389c27
2 changed files with 13 additions and 3 deletions

View File

@@ -160,6 +160,7 @@
"perspective!" :methods}
"Pixmap" {"pixmap" :methods
"pixmap!" :methods}
"Pixmap.Format" {"pixmap-format" :static-fields}
"Plane" {"plane" :methods
"plane!" :methods}
"Plane.PlaneSide" {"plane-side" :static-fields}

View File

@@ -1,9 +1,18 @@
(in-ns 'play-clj.core)
(defmacro pixmap-format
"Returns a static field from [Pixmap.Format](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.Format.html).
(pixmap-format :alpha)"
[k]
(u/gdx-field :graphics "Pixmap$Format" (u/key->pascal k)))
(defn pixmap*
[path]
(or (u/load-asset path Pixmap)
(Pixmap. (files! :internal path))))
([^String path]
(or (u/load-asset path Pixmap)
(Pixmap. (files! :internal path))))
([^long width ^long height ^Pixmap$Format fmt]
(Pixmap. width height fmt)))
(defmacro pixmap
"Returns a [Pixmap](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.html).