diff --git a/doclet/resources/classes.edn b/doclet/resources/classes.edn index bdd64db..0953600 100644 --- a/doclet/resources/classes.edn +++ b/doclet/resources/classes.edn @@ -101,6 +101,8 @@ "Input" {"input!" :methods} "Input.Keys" {"key-code" :static-fields "key-pressed?" :static-fields} + "Input.Buttons" {"button-code" :static-fields + "button-pressed?" :static-fields} "Interpolation" {"interpolation" :static-classes} "Intersector" {"intersector!" :static-methods} "IntAttribute" {"attribute :int" :constructors diff --git a/project.clj b/project.clj index db49875..7c34280 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject play-clj "0.2.4" +(defproject play-clj "0.2.5-SNAPSHOT" :description "A LibGDX wrapper for easy cross-platform game development" :url "https://github.com/oakes/play-clj" :license {:name "Public Domain" diff --git a/src/play_clj/core_basics.clj b/src/play_clj/core_basics.clj index 0a2bb9a..74c3bfe 100644 --- a/src/play_clj/core_basics.clj +++ b/src/play_clj/core_basics.clj @@ -116,6 +116,20 @@ [k] `(key-pressed? ~k)) +(defmacro button-code + "Returns a static field from [Input.Buttons](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Input.Buttons.html). + + (button-code :left)" + [k] + `~(u/gdx-field "Input$Buttons" (u/key->upper k))) + +(defmacro button-pressed? + "Returns a boolean indicating if the button cooresponding to `k` is being pressed. + + (button-pressed? :left)" + [k] + `(input! :is-button-pressed (button-code ~k))) + (defn ^:private add-input! [^InputProcessor p] (let [^InputMultiplexer multi (input! :get-input-processor)]