relative positioning needs to be based off the scale.

This commit is contained in:
2015-04-22 19:57:18 -07:00
parent d866c00cd9
commit 7495c63d88
2 changed files with 5 additions and 3 deletions

View File

@@ -21,20 +21,22 @@
(defrecord TextureEntity [object] Entity
(draw! [{:keys [^TextureRegion object x y width height
scale-x scale-y angle origin-x origin-y]}
scale-x scale-y angle origin-x origin-y something]}
_
batch]
(let [x (- (float (or x 0)) (* (float (or origin-x 0.0)) (float (or scale-x 1.0))))
y (float (or y 0))
width (float (or width (.getRegionWidth object)))
height (float (or height (.getRegionHeight object)))]
(if (or scale-x scale-y angle)
(let [scale-x (float (or scale-x 1))
scale-y (float (or scale-y 1))
origin-x (float (or origin-x (/ width 2)))
origin-y (float (or origin-y (/ height 2)))
angle (float (or angle 0))]
(.draw ^Batch batch object x y origin-x origin-y width height
(.draw ^Batch batch object x y (* origin-x scale-x) (* origin-y scale-y) width height
scale-x scale-y angle))
(.draw ^Batch batch object x y width height)))))