From 5f5e1e6e8b792421e905739e4bcfe9b6c848a4b6 Mon Sep 17 00:00:00 2001 From: oakes Date: Wed, 24 Sep 2014 12:18:56 -0400 Subject: [PATCH] Break skin initialization into separate function --- src/play_clj/ui.clj | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/play_clj/ui.clj b/src/play_clj/ui.clj index 76acc40..592c990 100644 --- a/src/play_clj/ui.clj +++ b/src/play_clj/ui.clj @@ -35,17 +35,20 @@ (str (u/key->pascal k) "Style.")) ~@options)) +(defn skin* + [path] + (or (u/load-asset path Skin) + (Skin. (if (string? path) + (.internal ^Files (Gdx/files) path) + path)))) + (defmacro skin "Returns a [Skin](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Skin.html) based on the file at `path`. (skin \"uiskin.json\")" [path & options] - `(u/calls! ^Skin (or (u/load-asset ~path Skin) - (Skin. (if (string? ~path) - (.internal ^Files (Gdx/files) ~path) - ~path))) - ~@options)) + `(u/calls! ^Skin (skin* ~path) ~@options)) (defmacro skin! "Calls a single method on a `skin`."