a number of cool improvements, hotspots for cursors, non-jumpy text.
This commit is contained in:
@@ -47,6 +47,9 @@
|
||||
|
||||
(def ^:const +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :charcoal :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot :active-main :shovel :broom :tune :hand :hand-depressed :talk :talk-depressed :look :look-depressed])
|
||||
|
||||
(def ^:const +cursor-hotspots+ {:look [8 8]
|
||||
:look-depressed [8 8]})
|
||||
|
||||
(def settings (atom {:music-volume 50.0
|
||||
:sound-volume 75.0
|
||||
:fullscreen true}))
|
||||
@@ -69,12 +72,15 @@
|
||||
target-width (* 16 scale)
|
||||
target-height (* 16 scale)
|
||||
resized (Pixmap. target-width target-height (.getFormat base-cursor))
|
||||
index (.indexOf +all-cursors+ which)]
|
||||
index (.indexOf +all-cursors+ which)
|
||||
[hot-x hot-y] (+cursor-hotspots+ which [0 0])
|
||||
hot-x (int hot-x)
|
||||
hot-y (int hot-y)]
|
||||
(Pixmap/setFilter Pixmap$Filter/NearestNeighbour)
|
||||
(pixmap! resized :draw-pixmap base-cursor (* index 18) 0 16 16
|
||||
0 0 target-width target-height)
|
||||
|
||||
(graphics! :new-cursor resized 0 0 )))
|
||||
(graphics! :new-cursor resized (* hot-x scale) (* hot-y scale) )))
|
||||
|
||||
(defn get-texture [path]
|
||||
(let [atlas-name (str/replace path #".png" "")
|
||||
@@ -388,6 +394,7 @@
|
||||
(first raw-pos) (last raw-pos)))
|
||||
hovering-ego (hovering-ego entities last-pos)
|
||||
current (get-in entities [:cursor :current])
|
||||
entities (assoc-in entities [:label :text] "")
|
||||
selected-inventory-item (@(resolve 'advent.screens.scene/get-selected-inventory-item))]
|
||||
|
||||
(cond
|
||||
@@ -408,13 +415,19 @@
|
||||
(assoc-in [:cursor :override] nil))
|
||||
|
||||
(and mouse-override (:only-script mouse-override))
|
||||
(assoc-in entities [:cursor :override] (:cursor mouse-override))
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] (:cursor mouse-override))
|
||||
(assoc-in [:label :text] (:label mouse-override)))
|
||||
|
||||
selected-inventory-item
|
||||
(assoc-in entities [:cursor :override] selected-inventory-item)
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] selected-inventory-item)
|
||||
(assoc-in [:label :text] (:label mouse-override)))
|
||||
|
||||
mouse-override
|
||||
(assoc-in entities [:cursor :override] (:cursor mouse-override))
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] (:cursor mouse-override))
|
||||
(assoc-in [:label :text] (:label mouse-override)))
|
||||
|
||||
:else
|
||||
(assoc-in entities [:cursor :override] :main))))
|
||||
|
||||
Reference in New Issue
Block a user