(animated-sprite sprite-group
pos
w
h
spritesheet-file
&
{:keys [rotation vel update-fn draw-fn animations
current-animation points bounds-fn]
:or {rotation 0
vel [0 0]
update-fn update-animated-sprite
draw-fn draw-animated-sprite
animations {:none
{:frames 1 :y-offset 0 :frame-delay 100}}
current-animation :none}})(default-bounding-poly {:keys [w h]})Generates a bounding polygon based off the w by h rectangle of
the sprite.
Generates a bounding polygon based off the `w` by `h` rectangle of the sprite.
(draw-animated-sprite {:keys [pos rotation w h spritesheet current-animation
animation-frame]
:as s})(draw-scene-sprites {:keys [current-scene] :as state}
&
{:keys [sprite-key] :or {sprite-key :sprites}})Draw each sprite in the current scene using its :draw-fn.
Optionally accepts a key specifying the name of the sprite collection on the scene.
Draw each sprite in the current scene using its `:draw-fn`. Optionally accepts a key specifying the name of the sprite collection on the scene.
(draw-scene-sprites-by-layers {:keys [current-scene] :as state}
layers
&
{:keys [sprite-key] :or {sprite-key :sprites}})Draw each sprite in the current scene using its :draw-fn in the
order their :sprite-group appears in the layers list.
Any sprites with groups not found in layers will be drawn last.
Optionally accepts a key specifying the name of the sprite collection on the scene.
Draw each sprite in the current scene using its `:draw-fn` in the order their `:sprite-group` appears in the `layers` list. Any sprites with groups not found in `layers` will be drawn last. Optionally accepts a key specifying the name of the sprite collection on the scene.
(group-pred sprite-group)Defines a predicate that filters sprites based on their sprite-group.
Commonly used alongside update-sprites-by-pred:
(qpsprite/update-sprites-by-pred state (qpsprite/group-pred :asteroids) sprite-update-fn)
Defines a predicate that filters sprites based on their sprite-group. Commonly used alongside `update-sprites-by-pred`: (qpsprite/update-sprites-by-pred state (qpsprite/group-pred :asteroids) sprite-update-fn)
(image-sprite sprite-group
pos
w
h
image-file
&
{:keys [rotation vel update-fn draw-fn points bounds-fn]
:or {rotation 0
vel [0 0]
update-fn update-image-sprite
draw-fn draw-image-sprite}})(static-sprite sprite-group
pos
w
h
image-file
&
{:keys [rotation update-fn draw-fn points bounds-fn]
:or {rotation 0 update-fn identity draw-fn draw-image-sprite}})(text-sprite content
pos
&
{:keys [offsets sprite-group font size color update-fn draw-fn]
:or {offsets [:center]
sprite-group :text
font qpu/default-font
size qpu/default-text-size
color qpu/black
update-fn identity
draw-fn draw-text-sprite}})(update-scene-sprites {:keys [current-scene] :as state}
&
{:keys [sprite-key] :or {sprite-key :sprites}})Update each sprite in the current scene using its :update-fn.
Optionally accepts a key specifying the name of the sprite collection on the scene.
Update each sprite in the current scene using its `:update-fn`. Optionally accepts a key specifying the name of the sprite collection on the scene.
(update-sprites-by-pred {:keys [current-scene] :as state}
pred
f
&
{:keys [sprite-key] :or {sprite-key :sprites}})Update sprites in the current scene with the update function f
filtering by a predicate function pred.
Optionally accepts a key specifying the name of the sprite collection on the scene.
Update sprites in the current scene with the update function `f` filtering by a predicate function `pred`. Optionally accepts a key specifying the name of the sprite collection on the scene.
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 |