From a8ea005a6358e9f6eba2e826f66b71e69d204f89 Mon Sep 17 00:00:00 2001 From: oakes Date: Fri, 16 May 2014 15:03:27 -0400 Subject: [PATCH] Add actor! and actor? to play-clj.ui --- doclet/resources/classes.edn | 3 ++- src/play_clj/ui.clj | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doclet/resources/classes.edn b/doclet/resources/classes.edn index 8556554..2c92be2 100644 --- a/doclet/resources/classes.edn +++ b/doclet/resources/classes.edn @@ -1,4 +1,5 @@ -{"ActorGestureListener" {"actor-gesture-listener!" :methods} +{"Actor" {"actor!" :methods} + "ActorGestureListener" {"actor-gesture-listener!" :methods} "Align" {"align" :static-fields} "com.badlogic.gdx.graphics.g2d.Animation" {"animation" :methods "animation!" :methods} diff --git a/src/play_clj/ui.clj b/src/play_clj/ui.clj index 3f4717d..b72cb66 100644 --- a/src/play_clj/ui.clj +++ b/src/play_clj/ui.clj @@ -168,6 +168,18 @@ based on the file at `path`. [^WidgetGroup group children] (apply add! (ActorEntity. group) children)) +; actor + +(defmacro actor! + "Calls a single method on an actor." + [entity k & options] + `(u/call! ^Actor (u/get-obj ~entity :object) ~k ~@options)) + +(defn actor? + "Returns true if `entity` is an actor." + [entity] + (isa? (type (u/get-obj entity :object)) Actor)) + ; check-box (defn check-box*