fixes: ui scale of inventory,save,close. intersects.

This commit is contained in:
Bryce Covert
2016-12-07 22:23:54 -08:00
parent c81614c5ef
commit 7c905309d8
3 changed files with 51 additions and 36 deletions

View File

@@ -65,8 +65,8 @@
:flask-with-contents [8 8]
:trophy [8 8]
:ladder [8 8]
:stick
:cat-toy
:stick [8 8]
:cat-toy [8 8]
:balloon [3 3]
:frog-legs [8 8]
:teddy [8 8]
@@ -406,10 +406,12 @@
(defn intersects? [e [x y]]
(when (:object e)
(let [object-x (or (:x e) (when (actor? e ) (.getX ^Actor (:object e))) 0)
object-y (or (:y e) (when (actor? e ) (.getY ^Actor (:object e))) 0)
object-width (or (:width e) (when (actor? e ) (.getWidth ^Actor (:object e))) 0)
object-height (or (:height e) (when (actor? e ) (.getHeight ^Actor (:object e))) 0)]
(let [object-width (* (:scale-x e 1.0) (or (:width e) (when (actor? e ) (.getWidth ^Actor (:object e))) 0))
object-height (* (:scale-y e 1.0) (or (:height e) (when (actor? e ) (.getHeight ^Actor (:object e))) 0))
origin-x (* (:scale-x e 1.0) (:origin-x e 0))
origin-y (* (:scale-y e 1.0) (:origin-y e 0))
object-x (- (or (:x e) (when (actor? e ) (.getX ^Actor (:object e))) 0) origin-x)
object-y (- (or (:y e) (when (actor? e ) (.getY ^Actor (:object e))) 0) origin-y)]
(and (:object e)
(< object-x x (+ object-x object-width))
@@ -449,8 +451,8 @@
[x y])))
(defn contains-point? [x1 y1 width height x y]
(and (< x1 x (+ x1 width))
(< y1 y (+ y1 height))))
(and (<= x1 x (+ x1 width))
(<= y1 y (+ y1 height))))
(defn is-unstoppable-script-running [screen entities]
(let [current-action (get-in entities [:fg-actions :current])