Allow shape entities to coexist with texture entities

This commit is contained in:
oakes
2014-04-21 22:36:10 -04:00
parent 7ff6ab60f4
commit f92cc42fa1

View File

@@ -67,17 +67,21 @@
(defrecord ShapeEntity [object] Entity (defrecord ShapeEntity [object] Entity
(draw-entity! [{:keys [^ShapeRenderer object type draw! x y z]} (draw-entity! [{:keys [^ShapeRenderer object type draw! x y z]}
{:keys [^Camera camera]} {:keys [^Camera camera]}
_] batch]
(let [^Matrix4 m (.getTransformMatrix object) (let [^Matrix4 m (.getTransformMatrix object)
x (float (or x 0)) x (float (or x 0))
y (float (or y 0)) y (float (or y 0))
z (float (or z 0))] z (float (or z 0))]
(.setTranslation m x y z)) (.setTranslation m x y z))
(when batch
(.end ^SpriteBatch batch))
(when camera (when camera
(.setProjectionMatrix object (. camera combined))) (.setProjectionMatrix object (. camera combined)))
(.begin object type) (.begin object type)
(draw!) (draw!)
(.end object))) (.end object)
(when batch
(.begin ^SpriteBatch batch))))
(defrecord BundleEntity [entities] Entity (defrecord BundleEntity [entities] Entity
(draw-entity! [{:keys [entities] :as entity} screen batch] (draw-entity! [{:keys [entities] :as entity} screen batch]