(button-sprite content
pos
&
{:keys [offsets on-click size color font font-size content-color
content-pos held? update-fn 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]
update-fn identity
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 builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |