Don't pre-set any values in texture entities

This commit is contained in:
oakes
2014-01-19 17:05:17 -05:00
parent f582f18392
commit dc68f7510e
2 changed files with 8 additions and 8 deletions

View File

@@ -159,10 +159,13 @@
(.draw object batch 1))
(defmethod draw-entity! :texture
[^SpriteBatch batch {:keys [^TextureRegion object x y width height]
:or {x 0 y 0}}]
[^SpriteBatch batch {:keys [^TextureRegion object x y width height]}]
(assert object)
(.draw batch object (float x) (float y) (float width) (float height)))
(let [x (float (or x 0))
y (float (or y 0))
width (float (or width (.getRegionWidth object)))
height (float (or height (.getRegionHeight object)))]
(.draw batch object x y width height)))
(defn draw! [{:keys [renderer] :as screen} entities]
(assert renderer)

View File

@@ -137,11 +137,8 @@
(defmulti create-entity class)
(defmethod create-entity TextureRegion
[^TextureRegion obj]
{:type :texture
:object obj
:width (.getRegionWidth obj)
:height (.getRegionHeight obj)})
[obj]
{:type :texture :object obj})
(defmethod create-entity Actor
[obj]