improving inventory item scales.
This commit is contained in:
@@ -165,25 +165,26 @@
|
|||||||
(assoc :shown? true
|
(assoc :shown? true
|
||||||
:opacity 0.0
|
:opacity 0.0
|
||||||
:items (into {} (for [[item index] (map vector items (range))
|
:items (into {} (for [[item index] (map vector items (range))
|
||||||
:let [row (int (/ index 8))
|
:let [row (int (/ index (Math/floor (/ 8 utils/ui-scale))))
|
||||||
column (mod index 8)
|
column (mod index (Math/floor (/ 8 utils/ui-scale)))
|
||||||
base-x (* 79 4)
|
base-x (* 79 4)
|
||||||
base-y (* 180 4)
|
base-y (* 180 4)
|
||||||
x (+ base-x (* column (* 24 4)))
|
item-width (* utils/ui-scale 4 18)
|
||||||
y (- base-y (* row (* 24 4)))
|
padding (/ item-width 4)
|
||||||
item-width 18
|
x (+ base-x (* column (+ padding item-width)))
|
||||||
|
y (- base-y (* row (+ padding item-width)))
|
||||||
offset-x (+ x (/ item-width 2))
|
offset-x (+ x (/ item-width 2))
|
||||||
offset-y (+ y (/ item-width 2))
|
offset-y (+ y (/ item-width 2))
|
||||||
padding (/ item-width 2)
|
padded-size (/ (+ item-width padding padding) 2)
|
||||||
padding (* 4 padding)]]
|
#_#_padding (* 4 padding)]]
|
||||||
[item (assoc (texture (aget (:all-items entities) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
|
[item (assoc (texture (aget (:all-items entities) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
|
||||||
:x x :y y
|
:x (+ x (/ padding 2)) :y (+ y (/ padding 2))
|
||||||
:scale-x 4
|
:scale-x (* utils/ui-scale 4)
|
||||||
:scale-y 4
|
:scale-y (* utils/ui-scale 4)
|
||||||
:origin-x 0
|
:origin-x 9
|
||||||
:origin-y 0
|
:origin-y 8
|
||||||
:item item
|
:item item
|
||||||
:box (zone/box (- offset-x padding) (- offset-y padding) (+ offset-x item-width padding padding) (+ offset-y item-width padding padding)))])))
|
:box (zone/box (- x padded-size) (- y padded-size) (+ x padded-size) (+ y (/ item-width 2))))])))
|
||||||
(assoc-in [:tweens :fade-in] (tween/tween :fade-in screen [:opacity] 0.0 1.0 0.2 :ease tween/ease-out-cubic)))))
|
(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
|
:on-mouse-moved mouse-move
|
||||||
|
|||||||
@@ -1919,6 +1919,7 @@ void main ()
|
|||||||
:baseline 9000
|
:baseline 9000
|
||||||
:opacity 0.8)
|
:opacity 0.8)
|
||||||
:inventory (assoc (utils/get-texture "inventory.png") :x (- 320 (* 21 utils/ui-scale)) :y (* 27 utils/ui-scale ) :baseline 9000
|
:inventory (assoc (utils/get-texture "inventory.png") :x (- 320 (* 21 utils/ui-scale)) :y (* 27 utils/ui-scale ) :baseline 9000
|
||||||
|
:intersect-width 42 :intersect-height 48
|
||||||
:width 42 :height 56
|
:width 42 :height 56
|
||||||
:origin-x 21 :origin-y 27
|
:origin-x 21 :origin-y 27
|
||||||
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
||||||
|
|||||||
@@ -406,8 +406,8 @@
|
|||||||
|
|
||||||
(defn intersects? [e [x y]]
|
(defn intersects? [e [x y]]
|
||||||
(when (:object e)
|
(when (:object e)
|
||||||
(let [object-width (* (:scale-x e 1.0) (or (:width e) (when (actor? e ) (.getWidth ^Actor (:object e))) 0))
|
(let [object-width (* (:scale-x e 1.0) (or (:intersect-width e) (: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))
|
object-height (* (:scale-y e 1.0) (or (:intersect-height e) (:height e) (when (actor? e ) (.getHeight ^Actor (:object e))) 0))
|
||||||
origin-x (* (:scale-x e 1.0) (:origin-x e 0))
|
origin-x (* (:scale-x e 1.0) (:origin-x e 0))
|
||||||
origin-y (* (:scale-y e 1.0) (:origin-y 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-x (- (or (:x e) (when (actor? e ) (.getX ^Actor (:object e))) 0) origin-x)
|
||||||
|
|||||||
Reference in New Issue
Block a user