more progress on ui scaling.

This commit is contained in:
Bryce Covert
2016-10-15 17:41:03 -07:00
parent 2f831bb4b2
commit 85945b7fa6
3 changed files with 78 additions and 48 deletions

View File

@@ -29,6 +29,10 @@
(.addListener ^Actor object listener))
entity)
(def ui-scale 1.75)
(def mobile? (= 1.75 ui-scale))
(defn clear-stage [{:keys [^Stage renderer]}]
(.clear renderer))
@@ -399,9 +403,16 @@
(vals tweens)))
(defn intersects? [e [x y]]
(and (:object e)
(< (:x e) x (+ (:x e) (or (:width e) (when (actor? e) (.getWidth ^Actor (:object e))))))
(< (:y e) y (+ (:y e) (or (:height e) (when (actor? e) (.getHeight ^Actor (:object e))))))))
(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)]
(println object-x object-y object-width object-height)
(and (:object e)
(< object-x x (+ object-x object-width))
(< object-y y (+ object-y object-height))))))
(defn get-current-music [entities]
(let [time (get-in entities [:state :time])