(button-sprite content
pos
&
{:keys [offsets on-click size color font font-size content-color
content-pos held? draw-fn collision-detection-fn]
:or {offsets [:center :center]
draw-fn draw-button-sprite
color qpu/grey
font-size qpu/large-text-size
content-pos [100 50]
content-color qpu/black
collision-detection-fn qpcollision/pos-in-rect?
on-click identity
font qpu/default-font
size [200 100]
held? false}})
(draw-button-sprite {:keys [content pos w h offsets color font content-color
content-pos held?]})
(handle-buttons-pressed {:keys [current-scene] :as state} {ex :x ey :y :as e})
Determine if any button sprites have been clicked on. If so invoke
their on-click
function and set their :held?
attribute to
true
.
Determine if any button sprites have been clicked on. If so invoke their `on-click` function and set their `:held?` attribute to `true`.
(handle-buttons-released {:keys [current-scene] :as state} _)
Set the :held?
atribute to false
for all sprites in the :button
sprite-group.
Set the `:held?` atribute to `false` for all sprites in the :button sprite-group.
(update-held {:keys [current-scene] :as state} {:keys [uuid] :as b})
Update the :held?
attribute of a specific button to indicate it is
being pressed.
Update the `:held?` attribute of a specific button to indicate it is being pressed.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close