From 0854b6c0e835a6518821caa300f5b35ead798661 Mon Sep 17 00:00:00 2001 From: oakes Date: Wed, 2 Apr 2014 19:48:36 -0400 Subject: [PATCH] Add pixmap --- src/play_clj/core.clj | 2 +- src/play_clj/core_graphics.clj | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/play_clj/core.clj b/src/play_clj/core.clj index d715f44..b251491 100644 --- a/src/play_clj/core.clj +++ b/src/play_clj/core.clj @@ -7,7 +7,7 @@ [com.badlogic.gdx.audio Sound] [com.badlogic.gdx.assets AssetManager] [com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera - PerspectiveCamera Texture VertexAttributes$Usage] + PerspectiveCamera Pixmap Texture VertexAttributes$Usage] [com.badlogic.gdx.graphics.g2d SpriteBatch] [com.badlogic.gdx.graphics.g3d ModelBatch] [com.badlogic.gdx.input GestureDetector diff --git a/src/play_clj/core_graphics.clj b/src/play_clj/core_graphics.clj index a9b2699..a9b823e 100644 --- a/src/play_clj/core_graphics.clj +++ b/src/play_clj/core_graphics.clj @@ -1,5 +1,22 @@ (in-ns 'play-clj.core) +; pixmaps + +(defmacro pixmap + "Returns a [Pixmap](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.html). + + (pixmap \"image.png\")" + [& args] + `~(if (string? (first args)) + `(Pixmap. (files! :internal ~(first args))) + `(Pixmap. ~@args))) + +(defmacro pixmap! + "Calls a single method on a `pixmap`." + [object k & options] + `(let [^Pixmap object# (u/get-obj ~object :renderer)] + (u/call! object# ~k ~@options))) + ; tiled maps (defn tiled-map*