Liking cljdoc? Tell your friends :D

quip.sprite

Sprites, for drawing and animating game objects.

The basic sprites provided are useful if simple, feel free to implement your own.

Sprites, for drawing and animating game objects.

The basic sprites provided are useful if simple, feel free to
implement your own.
raw docstring

animated-spriteclj

(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}})
source

default-bounding-polyclj

(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.
sourceraw docstring

draw-animated-spriteclj

(draw-animated-sprite {:keys [pos rotation w h spritesheet current-animation
                              animation-frame]
                       :as s})
source

draw-image-spriteclj

(draw-image-sprite {:keys [pos w h image]})
source

draw-scene-spritesclj

(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.
sourceraw docstring

draw-scene-sprites-by-layersclj

(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.
sourceraw docstring

draw-text-spriteclj

(draw-text-sprite {:keys [content pos offsets font size color]})
source

group-predclj

(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)
sourceraw docstring

image-spriteclj

(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}})
source

memo-graphicsclj

source

offset-posclj

(offset-pos [x y] w h)
source

set-animationclj

(set-animation s animation)
source

static-spriteclj

(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}})
source

text-spriteclj

(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}})
source

update-animated-spriteclj

(update-animated-sprite s)
source

update-animationclj

(update-animation {:keys [current-animation delay-count] :as s})
source

update-frame-delayclj

(update-frame-delay {:keys [current-animation] :as s})
source

update-image-spriteclj

(update-image-sprite s)
source

update-posclj

(update-pos {:keys [pos vel] :as s})
source

update-scene-spritesclj

(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.
sourceraw docstring

update-sprites-by-predclj

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close