Remove origin-x and origin-y from shape
This commit is contained in:
@@ -86,29 +86,27 @@
|
|||||||
(.render renderer object attributes)))
|
(.render renderer object attributes)))
|
||||||
|
|
||||||
(defrecord ShapeEntity [object] Entity
|
(defrecord ShapeEntity [object] Entity
|
||||||
(draw-entity! [{:keys [^ShapeRenderer object type draw! x y width height
|
(draw-entity! [{:keys [^ShapeRenderer object type draw! x y
|
||||||
angle origin-x origin-y]}
|
scale-x scale-y angle]}
|
||||||
{:keys [^Camera camera]}
|
{:keys [^Camera camera]}
|
||||||
batch]
|
batch]
|
||||||
|
(when batch
|
||||||
|
(.end ^SpriteBatch batch))
|
||||||
(when (or x y)
|
(when (or x y)
|
||||||
(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))]
|
||||||
(.setTranslation m x y 0)
|
(.setTranslation m x y 0)
|
||||||
(.setTransformMatrix object m)))
|
(.setTransformMatrix object m)))
|
||||||
(when batch
|
|
||||||
(.end ^SpriteBatch batch))
|
|
||||||
(when camera
|
(when camera
|
||||||
(.setProjectionMatrix object (. camera combined)))
|
(.setProjectionMatrix object (. camera combined)))
|
||||||
(.begin object type)
|
(.begin object type)
|
||||||
(when angle
|
(when (or scale-x scale-y angle)
|
||||||
(let [x (float (or x 0))
|
(let [scale-x (float (or scale-x 1))
|
||||||
y (float (or y 0))
|
scale-y (float (or scale-y 1))
|
||||||
origin-x (float (or origin-x (/ (or width 0) 2)))
|
|
||||||
origin-y (float (or origin-y (/ (or height 0) 2)))
|
|
||||||
angle (float (or angle 0))]
|
angle (float (or angle 0))]
|
||||||
(.identity object)
|
(.identity object)
|
||||||
(.translate object (+ x origin-x) (+ y origin-y) 0)
|
(.scale object scale-x scale-y 1)
|
||||||
(.rotate object 0 0 1 angle)))
|
(.rotate object 0 0 1 angle)))
|
||||||
(draw!)
|
(draw!)
|
||||||
(.end object)
|
(.end object)
|
||||||
|
|||||||
Reference in New Issue
Block a user