Change docstrings

This commit is contained in:
oakes
2014-03-31 19:57:19 -04:00
parent ed67cef30c
commit c036e36786
13 changed files with 249 additions and 376 deletions

View File

@@ -15,7 +15,7 @@
[play_clj.entities ActorEntity]))
(defmacro drawable
"Returns a subclass of [BaseDrawable](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/utils/BaseDrawable.html)
"Returns a subclass of [BaseDrawable](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/utils/BaseDrawable.html).
(drawable :texture-region)"
[k & options]
@@ -24,7 +24,7 @@
~@options))
(defmacro style
"Returns a style object whose class is determined by the keyword `k`
"Returns a style object whose class is determined by the keyword `k`.
(style :check-box)"
[k & options]
@@ -35,22 +35,21 @@
(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`
based on the file at `path`.
(skin \"uiskin.json\")"
[path & options]
`(u/calls! ^Skin (Skin. (.internal ^Files (Gdx/files) ~path)) ~@options))
(defmacro align
"Returns a static field from [Align](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/utils/Align.html)
"Returns a static field from [Align](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/utils/Align.html).
(align :center)"
[k]
`~(u/gdx-field :scenes :scene2d :utils :Align (u/key->camel k)))
(defn cell!
"Calls a single method on a [Cell](https://github.com/libgdx/libgdx/blob/master/gdx/src/com/esotericsoftware/tablelayout/Cell.java)
(this could probably be made into a macro...)"
"Calls a single method on a [Cell](https://github.com/libgdx/libgdx/blob/master/gdx/src/com/esotericsoftware/tablelayout/Cell.java)."
[^Cell cell & args]
(let [method (first args)
[[a1 a2 a3 a4] rest-args] (split-with #(not (keyword? %)) (rest args))]
@@ -98,16 +97,13 @@ based on the file at `path`
cell))
(defmulti add-to-group!
"Internal use only"
#(-> % first :object type) :default WidgetGroup)
(defn ^:private create-tree-node
"Internal use only"
[child]
{:object (Tree$Node. ^Actor (:object child))})
(defn ^:private add-tree-nodes
"Internal use only"
[parent children]
(when-let [node (add-to-group! [parent (first children)])]
(doseq [child (rest children)]
@@ -151,26 +147,24 @@ based on the file at `path`
(add-tree-nodes parent child)))
(defn add!
"Adds the entities in `children` to the `group` entity of type [WidgetGroup](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/WidgetGroup.html)"
"Adds the entities in `children` to the `group` entity of type [WidgetGroup](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/WidgetGroup.html)."
[group & children]
(doseq [child children]
(add-to-group! [group child]))
group)
(defn ^:private create-group
"Internal use only"
[^WidgetGroup group children]
(apply add! (ActorEntity. group) children))
; check-box
(defn check-box*
"The function version of `check-box`"
[^String text arg]
(ActorEntity. (CheckBox. text arg)))
(defmacro check-box
"Returns an entity based on [CheckBox](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/CheckBox.html)
"Returns an entity based on [CheckBox](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/CheckBox.html).
(check-box \"I'm a check box\" (style :check-box off on font color))
(check-box \"I'm a check box\" (skin \"uiskin.json\"))"
@@ -180,19 +174,18 @@ based on the file at `path`
entity#))
(defmacro check-box!
"Calls a single method on a `check-box`"
"Calls a single method on a `check-box`."
[entity k & options]
`(u/call! ^Checkbox (u/get-obj ~entity :object) ~k ~@options))
; dialog
(defn dialog*
"The function version of `dialog`"
[text arg]
(ActorEntity. (Dialog. text arg)))
(defmacro dialog
"Returns an entity based on [Dialog](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Dialog.html)
"Returns an entity based on [Dialog](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Dialog.html).
(dialog \"I'm a dialog\" (style :window font font-color background))
(dialog \"I'm a dialog\" (skin \"uiskin.json\"))"
@@ -202,19 +195,18 @@ based on the file at `path`
entity#))
(defmacro dialog!
"Calls a single method on a `dialog`"
"Calls a single method on a `dialog`."
[entity k & options]
`(u/call! ^Dialog (u/get-obj ~entity :object) ~k ~@options))
; horizontal
(defn horizontal*
"The function version of `horizontal`"
[children]
(create-group (HorizontalGroup.) children))
(defmacro horizontal
"Returns an entity based on [HorizontalGroup](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html)
"Returns an entity based on [HorizontalGroup](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/HorizontalGroup.html).
(horizontal [entity-1 entity-2])"
[children & options]
@@ -223,14 +215,13 @@ based on the file at `path`
entity#))
(defmacro horizontal!
"Calls a single method on a `horizontal`"
"Calls a single method on a `horizontal`."
[entity k & options]
`(u/call! ^HorizontalGroup (u/get-obj ~entity :object) ~k ~@options))
; image
(defn image*
"The function version of `image`"
[arg]
(ActorEntity.
(cond
@@ -242,7 +233,7 @@ based on the file at `path`
(Image. arg))))
(defmacro image
"Returns an entity based on [Image](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Image.html)
"Returns an entity based on [Image](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Image.html).
(image \"image.png\")"
[arg & options]
@@ -251,19 +242,18 @@ based on the file at `path`
entity#))
(defmacro image!
"Calls a single method on a `image`"
"Calls a single method on a `image`."
[entity k & options]
`(u/call! ^Image (u/get-obj ~entity :object) ~k ~@options))
; image-button
(defn image-button*
"The function version of `image-button`"
[arg]
(ActorEntity. (ImageButton. arg)))
(defmacro image-button
"Returns an entity based on [ImageButton](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ImageButton.html)
"Returns an entity based on [ImageButton](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ImageButton.html).
(image-button (style :image-button up dn check img-up img-dn img-check))
(image-button (skin \"uiskin.json\"))"
@@ -273,19 +263,18 @@ based on the file at `path`
entity#))
(defmacro image-button!
"Calls a single method on a `image-button`"
"Calls a single method on a `image-button`."
[entity k & options]
`(u/call! ^ImageButton (u/get-obj ~entity :object) ~k ~@options))
; image-text-button
(defn image-text-button*
"The function version of `image-text-button`"
[^String text arg]
(ActorEntity. (ImageTextButton. text arg)))
(defmacro image-text-button
"Returns an entity based on [ImageTextButton](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ImageTextButton.html)
"Returns an entity based on [ImageTextButton](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ImageTextButton.html).
(image-text-button \"I'm an image text button\"
(style :image-text-button up down checked font))
@@ -296,14 +285,13 @@ based on the file at `path`
entity#))
(defmacro image-text-button!
"Calls a single method on a `image-text-button`"
"Calls a single method on a `image-text-button`."
[entity k & options]
`(u/call! ^ImageTextButton (u/get-obj ~entity :object) ~k ~@options))
; label
(defn label*
"The function version of `label`"
[^String text arg]
(ActorEntity.
(if (isa? (type arg) Color)
@@ -311,7 +299,7 @@ based on the file at `path`
(Label. text arg))))
(defmacro label
"Returns an entity based on [Label](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Label.html)
"Returns an entity based on [Label](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Label.html).
(label \"I'm a label\" (color :white))
(label \"I'm a label\" (style :label (g2d/bitmap-font) (color :white)))
@@ -322,19 +310,18 @@ based on the file at `path`
entity#))
(defmacro label!
"Calls a single method on a `label`"
"Calls a single method on a `label`."
[entity k & options]
`(u/call! ^Label (u/get-obj ~entity :object) ~k ~@options))
; scroll-pane
(defn scroll-pane*
"The function version of `scroll-pane`"
[child arg]
(ActorEntity. (ScrollPane. (u/get-obj child :object) arg)))
(defmacro scroll-pane
"Returns an entity based on [ScrollPane](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ScrollPane.html)
"Returns an entity based on [ScrollPane](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ScrollPane.html).
(scroll-pane table-entity (style :scroll-pane back h h-knob v v-knob))
(scroll-pane table-entity (skin \"uiskin.json\"))"
@@ -344,19 +331,18 @@ based on the file at `path`
entity#))
(defmacro scroll-pane!
"Calls a single method on a `scroll-pane`"
"Calls a single method on a `scroll-pane`."
[entity k & options]
`(u/call! ^ScrollPane (u/get-obj ~entity :object) ~k ~@options))
; select-box
(defn select-box*
"The function version of `select-box`"
[items arg]
(ActorEntity. (SelectBox. (into-array items) arg)))
(defmacro select-box
"Returns an entity based on [SelectBox](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/SelectBox.html)
"Returns an entity based on [SelectBox](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/SelectBox.html).
(select-box [\"Item 1\" \"Item 2\" \"Item 3\"]
(style :select-box font color back scroll-style list-style))
@@ -367,14 +353,13 @@ based on the file at `path`
entity#))
(defmacro select-box!
"Calls a single method on a `select-box`"
"Calls a single method on a `select-box`."
[entity k & options]
`(u/call! ^SelectBox (u/get-obj ~entity :object) ~k ~@options))
; slider
(defn slider*
"The function version of `slider`"
[{:keys [min max step vertical?]
:or {min 0 max 10 step 1 vertical? false}}
arg]
@@ -382,7 +367,7 @@ based on the file at `path`
(Slider. (float min) (float max) (float step) vertical? arg)))
(defmacro slider
"Returns an entity based on [Slider](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Slider.html)
"Returns an entity based on [Slider](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Slider.html).
(slider {:min 0 :max 10 :step 1 :vertical? false} (style :slider back knob))
(slider {:min 0 :max 10 :step 1 :vertical? false} (skin \"uiskin.json\"))"
@@ -392,19 +377,18 @@ based on the file at `path`
entity#))
(defmacro slider!
"Calls a single method on a `slider`"
"Calls a single method on a `slider`."
[entity k & options]
`(u/call! ^Slider (u/get-obj ~entity :object) ~k ~@options))
; stack
(defn stack*
"The function version of `stack`"
[children]
(create-group (Stack.) children))
(defmacro stack
"Returns an entity based on [Stack](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Stack.html)
"Returns an entity based on [Stack](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Stack.html).
(stack [entity-1 entity-2])"
[children & options]
@@ -413,19 +397,18 @@ based on the file at `path`
entity#))
(defmacro stack!
"Calls a single method on a `stack`"
"Calls a single method on a `stack`."
[entity k & options]
`(u/call! ^Stack (u/get-obj ~entity :object) ~k ~@options))
; table
(defn table*
"The function version of `table`"
[children]
(create-group (Table.) children))
(defmacro table
"Returns an entity based on [Table](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Table.html)
"Returns an entity based on [Table](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Table.html).
(table [entity-1 entity-2])"
[children & options]
@@ -434,19 +417,18 @@ based on the file at `path`
entity#))
(defmacro table!
"Calls a single method on a `table`"
"Calls a single method on a `table`."
[entity k & options]
`(u/call! ^Table (u/get-obj ~entity :object) ~k ~@options))
; text-button
(defn text-button*
"The function version of `text-button`"
[^String text arg]
(ActorEntity. (TextButton. text arg)))
(defmacro text-button
"Returns an entity based on [TextButton](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/TextButton.html)
"Returns an entity based on [TextButton](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/TextButton.html).
(text-button \"I'm a text button\" (style :text-button up dn checked font))
(text-button \"I'm a text button\" (skin \"uiskin.json\"))"
@@ -456,19 +438,18 @@ based on the file at `path`
entity#))
(defmacro text-button!
"Calls a single method on a `text-button`"
"Calls a single method on a `text-button`."
[entity k & options]
`(u/call! ^TextButton (u/get-obj ~entity :object) ~k ~@options))
; text-field
(defn text-field*
"The function version of `text-field`"
[^String text arg]
(ActorEntity. (TextField. text arg)))
(defmacro text-field
"Returns an entity based on [TextField](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/TextField.html)
"Returns an entity based on [TextField](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/TextField.html).
(text-field \"I'm a text field\" (style :text-field font col cur sel back))
(text-field \"I'm a text field\" (skin \"uiskin.json\"))"
@@ -478,19 +459,18 @@ based on the file at `path`
entity#))
(defmacro text-field!
"Calls a single method on a `text-field`"
"Calls a single method on a `text-field`."
[entity k & options]
`(u/call! ^TextField (u/get-obj ~entity :object) ~k ~@options))
; tree
(defn tree*
"The function version of `tree`"
[children arg]
(create-group (Tree. arg) children))
(defmacro tree
"Returns an entity based on [Tree](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Tree.html)
"Returns an entity based on [Tree](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Tree.html).
(tree [entity-1 entity-2] (style :tree plus minus selection))
(tree [entity-1 entity-2] (skin \"uiskin.json\"))"
@@ -500,19 +480,18 @@ based on the file at `path`
entity#))
(defmacro tree!
"Calls a single method on a `tree`"
"Calls a single method on a `tree`."
[entity k & options]
`(u/call! ^Tree (u/get-obj ~entity :object) ~k ~@options))
; vertical
(defn vertical*
"The function version of `vertical`"
[children]
(create-group (VerticalGroup.) children))
(defmacro vertical
"Returns an entity based on [VerticalGroup](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/VerticalGroup.html)
"Returns an entity based on [VerticalGroup](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/VerticalGroup.html).
(vertical [entity-1 entity-2])"
[children & options]
@@ -521,19 +500,18 @@ based on the file at `path`
entity#))
(defmacro vertical!
"Calls a single method on a `vertical`"
"Calls a single method on a `vertical`."
[entity k & options]
`(u/call! ^VerticalGroup (u/get-obj ~entity :object) ~k ~@options))
; window
(defn window*
"The function version of `window`"
[children ^String title arg]
(create-group (Window. title arg) children))
(defmacro window
"Returns an entity based on [Window](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Window.html)
"Returns an entity based on [Window](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Window.html).
(window [entity-1 entity-2] \"I'm a window\" (style :window title font col))
(window [entity-1 entity-2] \"I'm a window\" (skin \"uiskin.json\"))"
@@ -543,6 +521,6 @@ based on the file at `path`
entity#))
(defmacro window!
"Calls a single method on a `window`"
"Calls a single method on a `window`."
[entity k & options]
`(u/call! ^Window (u/get-obj ~entity :object) ~k ~@options))