ordered dialogue trees
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
tx (.getTexture tr)
|
||||
_ (texture! tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)]
|
||||
(-> entities
|
||||
(into (for [[text i] (map vector (keys choices) (range))]
|
||||
(into (for [[[text] i] (map vector choices (range))]
|
||||
[i (assoc (label text (style :label font (color :white))) :x 30 :y (* 30 i))]))
|
||||
(assoc :state {:object nil :callback callback :choices choices}))))
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
||||
(when (seq entities)
|
||||
(when (< y (* 30 (count entities)))
|
||||
((get-in entities [:state :callback]) (nth (keys (get-in entities [:state :choices])) (int (/ y 30))))
|
||||
((get-in entities [:state :callback]) (int (/ y 30)))
|
||||
{}))))
|
||||
|
||||
:on-mouse-moved (fn [screen [entities]]
|
||||
|
||||
Reference in New Issue
Block a user