Modify and add boolean functions

This commit is contained in:
oakes
2014-04-07 01:56:35 -04:00
parent 6e45161518
commit 8d0502560a
4 changed files with 85 additions and 10 deletions

View File

@@ -58,7 +58,7 @@
(defn shape?
"Returns true if `entity` is a `shape`."
[entity]
(isa? (type entity) ShapeEntity))
(isa? (type (u/get-obj entity :object)) ShapeRenderer))
; tiled maps

View File

@@ -51,7 +51,7 @@
(defn texture?
"Returns true if `entity` is a `texture`."
[entity]
(isa? (type entity) TextureEntity))
(isa? (type (u/get-obj entity :object)) TextureRegion))
; nine-patch
@@ -92,7 +92,7 @@
(defn nine-patch?
"Returns true if `entity` is a `nine-patch`."
[entity]
(isa? (type entity) NinePatchEntity))
(isa? (type (u/get-obj entity :object)) NinePatch))
; particle-effect
@@ -121,7 +121,7 @@
(defn particle-effect?
"Returns true if `entity` is a `particle-effect`."
[entity]
(isa? (type entity) ParticleEffectEntity))
(isa? (type (u/get-obj entity :object)) ParticleEffect))
; texture-atlas

View File

@@ -94,7 +94,7 @@
(defn model?
"Returns true if `entity` is a `model`."
[entity]
(isa? (type entity) ModelEntity))
(isa? (type (u/get-obj entity :object)) ModelInstance))
; model-builder

View File

@@ -14,11 +14,6 @@
[com.esotericsoftware.tablelayout Cell]
[play_clj.entities ActorEntity]))
(defn actor?
"Returns true if `entity` is one of the UI entities."
[entity]
(isa? (type entity) ActorEntity))
(defmacro drawable
"Returns a subclass of [BaseDrawable](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/utils/BaseDrawable.html).
@@ -207,6 +202,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Dialog (u/get-obj ~entity :object) ~k ~@options))
(defn dialog?
"Returns true if `entity` is a `dialog`."
[entity]
(isa? (type (u/get-obj entity :object)) Dialog))
; horizontal
(defn horizontal*
@@ -227,6 +227,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^HorizontalGroup (u/get-obj ~entity :object) ~k ~@options))
(defn horizontal?
"Returns true if `entity` is a `horizontal`."
[entity]
(isa? (type (u/get-obj entity :object)) HorizontalGroup))
; image
(defn image*
@@ -254,6 +259,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Image (u/get-obj ~entity :object) ~k ~@options))
(defn image?
"Returns true if `entity` is an `image`."
[entity]
(isa? (type (u/get-obj entity :object)) Image))
; image-button
(defn image-button*
@@ -275,6 +285,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^ImageButton (u/get-obj ~entity :object) ~k ~@options))
(defn image-button?
"Returns true if `entity` is an `image-button`."
[entity]
(isa? (type (u/get-obj entity :object)) ImageButton))
; image-text-button
(defn image-text-button*
@@ -297,6 +312,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^ImageTextButton (u/get-obj ~entity :object) ~k ~@options))
(defn image-text-button?
"Returns true if `entity` is a `image-text-button`."
[entity]
(isa? (type (u/get-obj entity :object)) ImageTextButton))
; label
(defn label*
@@ -322,6 +342,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Label (u/get-obj ~entity :object) ~k ~@options))
(defn label?
"Returns true if `entity` is a `label`."
[entity]
(isa? (type (u/get-obj entity :object)) Label))
; scroll-pane
(defn scroll-pane*
@@ -343,6 +368,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^ScrollPane (u/get-obj ~entity :object) ~k ~@options))
(defn scroll-pane?
"Returns true if `entity` is a `scroll-pane`."
[entity]
(isa? (type (u/get-obj entity :object)) ScrollPane))
; select-box
(defn select-box*
@@ -365,6 +395,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^SelectBox (u/get-obj ~entity :object) ~k ~@options))
(defn select-box?
"Returns true if `entity` is a `select-box`."
[entity]
(isa? (type (u/get-obj entity :object)) SelectBox))
; slider
(defn slider*
@@ -389,6 +424,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Slider (u/get-obj ~entity :object) ~k ~@options))
(defn slider?
"Returns true if `entity` is a `slider`."
[entity]
(isa? (type (u/get-obj entity :object)) Slider))
; stack
(defn stack*
@@ -409,6 +449,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Stack (u/get-obj ~entity :object) ~k ~@options))
(defn stack?
"Returns true if `entity` is a `stack`."
[entity]
(isa? (type (u/get-obj entity :object)) Stack))
; table
(defn table*
@@ -429,6 +474,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Table (u/get-obj ~entity :object) ~k ~@options))
(defn table?
"Returns true if `entity` is a `table`."
[entity]
(isa? (type (u/get-obj entity :object)) Table))
; text-button
(defn text-button*
@@ -450,6 +500,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^TextButton (u/get-obj ~entity :object) ~k ~@options))
(defn text-button?
"Returns true if `entity` is a `text-button`."
[entity]
(isa? (type (u/get-obj entity :object)) TextButton))
; text-field
(defn text-field*
@@ -471,6 +526,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^TextField (u/get-obj ~entity :object) ~k ~@options))
(defn text-field?
"Returns true if `entity` is a `text-field`."
[entity]
(isa? (type (u/get-obj entity :object)) TextField))
; tree
(defn tree*
@@ -492,6 +552,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^Tree (u/get-obj ~entity :object) ~k ~@options))
(defn tree?
"Returns true if `entity` is a `tree`."
[entity]
(isa? (type (u/get-obj entity :object)) Tree))
; vertical
(defn vertical*
@@ -512,6 +577,11 @@ based on the file at `path`.
[entity k & options]
`(u/call! ^VerticalGroup (u/get-obj ~entity :object) ~k ~@options))
(defn vertical?
"Returns true if `entity` is a `vertical`."
[entity]
(isa? (type (u/get-obj entity :object)) VerticalGroup))
; window
(defn window*
@@ -532,3 +602,8 @@ based on the file at `path`.
"Calls a single method on a `window`."
[entity k & options]
`(u/call! ^Window (u/get-obj ~entity :object) ~k ~@options))
(defn window?
"Returns true if `entity` is a `window`."
[entity]
(isa? (type (u/get-obj entity :object)) Window))