many many bug fixes.

This commit is contained in:
Bryce Covert
2017-01-12 23:30:32 -08:00
parent d08bb503ac
commit 9369a2ea9c
16 changed files with 74 additions and 83 deletions

View File

@@ -36,9 +36,9 @@
:down-time (:total-time screen))))
(defn mouse-outside-inventory? [[x y]]
(or (< x 80)
(> x 1200)
(< y 80)
(or (< x 140)
(> x 1140)
(< y 320)
(> y 880)))
(defn mouse-drag [screen {:keys [selected-item] :as entities} options]
@@ -51,8 +51,8 @@
selected-item
(-> entities
(assoc-in [:items selected-item :x] (- x 32))
(assoc-in [:items selected-item :y] (- y 32))
(assoc-in [:items selected-item :x] x)
(assoc-in [:items selected-item :y] y)
(assoc :dragged? true)
(assoc :hovered-item (:item hovered-entity)))
:else
@@ -172,20 +172,23 @@
base-y (* 180 4)
item-width (* utils/ui-scale 4 18)
padding (/ item-width 4)
item-height (* utils/ui-scale 4 16)
padding-height (/ item-height 4)
x (+ base-x (* column (+ padding item-width)))
y (- base-y (* row (+ padding item-width)))
offset-x (+ x (/ item-width 2))
offset-y (+ y (/ item-width 2))
padded-size (/ (+ item-width padding padding) 2)
padded-width (/ (+ item-width padding padding) 2)
padded-height (/ (+ item-height padding-height padding-height) 2)
#_#_padding (* 4 padding)]]
[item (assoc (texture (aget (:all-items entities) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
:x (+ x (/ padding 2)) :y (+ y (/ padding 2))
:x (+ x (/ padding 2)) :y y
:scale-x (* utils/ui-scale 4)
:scale-y (* utils/ui-scale 4)
:origin-x 9
:origin-y 8
:item item
:box (zone/box (- x padded-size) (- y padded-size) (+ x padded-size) (+ y (/ item-width 2))))])))
:box (zone/box (- x padded-width) (- y padded-height) (+ x padded-width) (+ y padded-height)))])))
(assoc-in [:tweens :fade-in] (tween/tween :fade-in screen [:opacity] 0.0 1.0 0.2 :ease tween/ease-out-cubic)))))
:on-mouse-moved mouse-move