Add docstrings to the rest of core-global
This commit is contained in:
@@ -84,6 +84,11 @@ object"
|
|||||||
; input/output
|
; input/output
|
||||||
|
|
||||||
(defn game
|
(defn game
|
||||||
|
"Calls the global method cooresponding to `k` in a more Clojuresque way
|
||||||
|
|
||||||
|
(game :width)
|
||||||
|
(game :is-touched?)
|
||||||
|
"
|
||||||
[k]
|
[k]
|
||||||
(case k
|
(case k
|
||||||
:width (graphics! :get-width)
|
:width (graphics! :get-width)
|
||||||
@@ -96,19 +101,31 @@ object"
|
|||||||
(u/throw-key-not-found k)))
|
(u/throw-key-not-found k)))
|
||||||
|
|
||||||
(defmacro key-code
|
(defmacro key-code
|
||||||
|
"Returns the static field cooresponding to `k` from [Input.Keys](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Input.Keys.html)
|
||||||
|
|
||||||
|
(key-code :a)
|
||||||
|
(key-code :page-down)
|
||||||
|
"
|
||||||
[k]
|
[k]
|
||||||
`~(symbol (str u/main-package ".Input$Keys/" (u/key->upper k))))
|
`~(symbol (str u/main-package ".Input$Keys/" (u/key->upper k))))
|
||||||
|
|
||||||
(defmacro is-pressed?
|
(defmacro is-pressed?
|
||||||
|
"Returns a boolean indicating if the key cooresponding to `k` is being pressed
|
||||||
|
|
||||||
|
(is-pressed? :a)
|
||||||
|
(is-pressed? :page-down)
|
||||||
|
"
|
||||||
[k]
|
[k]
|
||||||
`(input! :is-key-pressed (key-code ~k)))
|
`(input! :is-key-pressed (key-code ~k)))
|
||||||
|
|
||||||
(defn ^:private add-input!
|
(defn ^:private add-input!
|
||||||
|
"Internal use only"
|
||||||
[^InputProcessor p]
|
[^InputProcessor p]
|
||||||
(let [^InputMultiplexer multi (input! :get-input-processor)]
|
(let [^InputMultiplexer multi (input! :get-input-processor)]
|
||||||
(.addProcessor multi p)))
|
(.addProcessor multi p)))
|
||||||
|
|
||||||
(defn ^:private remove-input!
|
(defn ^:private remove-input!
|
||||||
|
"Internal use only"
|
||||||
[^InputProcessor p]
|
[^InputProcessor p]
|
||||||
(let [^InputMultiplexer multi (input! :get-input-processor)]
|
(let [^InputMultiplexer multi (input! :get-input-processor)]
|
||||||
(.removeProcessor multi p)))
|
(.removeProcessor multi p)))
|
||||||
|
|||||||
Reference in New Issue
Block a user