mouse overrides.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
||||
(println (:input-x screen) (:input-y screen) "->" x y)))
|
||||
|
||||
(def +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 :watch :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot])
|
||||
(def +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 :watch :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])
|
||||
|
||||
(def settings (atom {:music-volume 50.0
|
||||
:sound-volume 75.0}))
|
||||
@@ -125,9 +125,14 @@
|
||||
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))))
|
||||
|
||||
(defn find-override [entities [x y]]
|
||||
(first (filter #(and ((:mouse-in? %) entities x y)
|
||||
(:cursor %))
|
||||
(get-in entities [:room :interactions]))))
|
||||
(first (concat (filter #(and ((:mouse-in? %) entities x y)
|
||||
(:override %))
|
||||
(get-in entities [:room :interactions]))
|
||||
(filter #(and (:mouse-in? %)
|
||||
((:mouse-in? %) entities x y))
|
||||
(vals (get-in entities [:room :entities])))
|
||||
(filter #(and ((:mouse-in? %) entities x y))
|
||||
(get-in entities [:room :interactions])))))
|
||||
|
||||
|
||||
|
||||
@@ -198,6 +203,6 @@
|
||||
(let [last-pos (unproject screen (get-in entities [:cursor :last-pos]))]
|
||||
(if (get-in entities [:state :active?])
|
||||
(if-let [mouse-override (find-override entities last-pos)]
|
||||
(assoc-in entities [:cursor :override] (:cursor mouse-override))
|
||||
(assoc-in entities [:cursor :override] (or (:cursor mouse-override) :active-main))
|
||||
(assoc-in entities [:cursor :override] nil))
|
||||
entities)))
|
||||
|
||||
Reference in New Issue
Block a user