Only allow entities that implement the draw-entity! function

This commit is contained in:
oakes
2014-03-21 19:23:06 -04:00
parent 8dd9024fc7
commit bc0844310d
2 changed files with 10 additions and 8 deletions

View File

@@ -179,6 +179,12 @@ new object to be created each time a field is set)
"Internal use only"
(draw-entity! [this batch] "Draws the entity"))
(extend-protocol Entity
clojure.lang.PersistentArrayMap
(draw-entity! [this batch])
clojure.lang.PersistentHashMap
(draw-entity! [this batch]))
(defrecord TextureEntity [object] Entity
(draw-entity! [{:keys [^TextureRegion object x y width height]} batch]
(let [x (float (or x 0))