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 offsets extra]
                  :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
                       offsets [:center]
                       extra {}}})
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-sprite!clj

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

draw-default!clj

(draw-default! {:keys [pos w h] :as s})
source

draw-image-sprite!clj

(draw-image-sprite! {:keys [pos rotation image] :as sprite})
source

draw-scene-sprites!clj

(draw-scene-sprites! {:keys [current-scene] :as state})

Draw each sprite in the current scene using its :draw-fn.

Draw each sprite in the current scene using its `:draw-fn`.
sourceraw docstring

draw-scene-sprites-by-layers!clj

(draw-scene-sprites-by-layers! {:keys [current-scene] :as state} layers)

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.

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

draw-text-spriteclj

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

has-groupclj

(has-group sprite-group)

Creates a predicate function that filters sprites based on their :sprite-group.

Takes either a single :sprite-group keyword, or a collection of them.

Commonly used alongside update-sprites-by-pred:

(sprite/update-sprites-by-pred state (sprite/has-group :asteroids) sprite-update-fn)

(sprite/update-sprites-by-pred state (sprite/has-group [:asteroids :ships]) sprite-update-fn)

Creates a predicate function that filters sprites based on their
`:sprite-group.`

Takes either a single `:sprite-group` keyword, or a collection of
them.

Commonly used alongside `update-sprites-by-pred`:

(sprite/update-sprites-by-pred
  state
  (sprite/has-group :asteroids)
  sprite-update-fn)

(sprite/update-sprites-by-pred
  state
  (sprite/has-group [:asteroids :ships])
  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 offsets
                      extra]
               :or {rotation 0
                    vel [0 0]
                    update-fn update-pos
                    draw-fn draw-image-sprite!
                    offsets [:center]
                    extra {}}})
source

is-spriteclj

(is-sprite {:keys [uuid]})
source

memo-graphicsclj

source

pos-offsetsclj

(pos-offsets {[x-off y-off] :offsets :keys [w h]})

Determine the x and y offsets for a sprite based on it's :w, :h and :offsets configuration.

Defaults to [:center :center].

Determine the x and y offsets for a sprite based on it's `:w`, `:h`
and `:offsets` configuration.

Defaults to `[:center :center]`.
sourceraw docstring

set-animationclj

(set-animation s animation)
source

spriteclj

(sprite sprite-group
        pos
        &
        {:keys [w h vel update-fn draw-fn points bounds-fn offsets extra]
         :or {w 20
              h 20
              vel [0 0]
              update-fn update-pos
              draw-fn draw-default!
              offsets [:center]
              extra {}}})

The simplest sensible sprite.

Contains a position, velocity, dimensions for collision detection, can be enriched with any custom fields via the :extra kwarg.

The simplest sensible sprite.

Contains a position, velocity, dimensions for collision detection,
can be enriched with any custom fields via the `:extra` kwarg.
sourceraw docstring

text-spriteclj

(text-sprite content
             pos
             &
             {:keys [offsets sprite-group font size color update-fn draw-fn
                     extra]
              :or {offsets [:center]
                   sprite-group :text
                   font u/default-font
                   size u/default-text-size
                   color u/black
                   update-fn identity
                   draw-fn draw-text-sprite
                   extra {}}})
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-posclj

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

update-spritesclj

(update-sprites state f)
(update-sprites {:keys [current-scene] :as state} pred f)

Update sprites in the current scene with the update function f.

Optionally takes a filtering function pred.

Update sprites in the current scene with the update function `f`.

Optionally takes a filtering function `pred`.
sourceraw docstring

update-stateclj

(update-state {:keys [current-scene] :as state})

Update each sprite in the current scene using its :update-fn.

Update each sprite in the current scene using its `:update-fn`.
sourceraw docstring

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

× close