Add bundle
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
[com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align
|
[com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align
|
||||||
ChangeListener ClickListener DragListener FocusListener]
|
ChangeListener ClickListener DragListener FocusListener]
|
||||||
[com.badlogic.gdx.utils ScreenUtils Timer$Task]
|
[com.badlogic.gdx.utils ScreenUtils Timer$Task]
|
||||||
[play_clj.entities ShapeEntity]))
|
[play_clj.entities BundleEntity ShapeEntity]))
|
||||||
|
|
||||||
(load "core_basics")
|
(load "core_basics")
|
||||||
(load "core_cameras")
|
(load "core_cameras")
|
||||||
|
|||||||
@@ -7,6 +7,16 @@
|
|||||||
[& body]
|
[& body]
|
||||||
`(app! :post-runnable (fn [] ~@body)))
|
`(app! :post-runnable (fn [] ~@body)))
|
||||||
|
|
||||||
|
(defn bundle
|
||||||
|
"Returns an entity containing other entities. This is a useful way to keep
|
||||||
|
related entities together. They will be drawn in the order they appear in the
|
||||||
|
internal :entities vector.
|
||||||
|
|
||||||
|
(bundle (shape :filled) (texture \"image.png\"))
|
||||||
|
(assoc (bundle) :entities [])"
|
||||||
|
[& entities]
|
||||||
|
(BundleEntity. entities))
|
||||||
|
|
||||||
(defn screenshot!
|
(defn screenshot!
|
||||||
"Captures a screenshot and either returns it as a `pixmap` or saves it to the
|
"Captures a screenshot and either returns it as a `pixmap` or saves it to the
|
||||||
specified path.
|
specified path.
|
||||||
|
|||||||
@@ -73,3 +73,8 @@
|
|||||||
(.begin object type)
|
(.begin object type)
|
||||||
(draw!)
|
(draw!)
|
||||||
(.end object)))
|
(.end object)))
|
||||||
|
|
||||||
|
(defrecord BundleEntity [entities] Entity
|
||||||
|
(draw-entity! [{:keys [entities]} screen batch]
|
||||||
|
(doseq [e entities]
|
||||||
|
(draw-entity! e screen batch))))
|
||||||
|
|||||||
Reference in New Issue
Block a user