diff options
author | David Thompson <dthompson2@worcester.edu> | 2022-08-01 16:06:49 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2022-08-01 16:08:58 -0400 |
commit | f24c10e7fc455c092bff051d57a066d81fd77ec3 (patch) | |
tree | 1adb361ef54fb71978d029fe699c17e2cfa78016 | |
parent | 7e9c865bc248a996ba9a360eb1392d05aa8a2010 (diff) |
graphics: sprite: Add #:shear argument to draw-sprite.
-rw-r--r-- | chickadee/graphics/sprite.scm | 13 | ||||
-rw-r--r-- | doc/api.texi | 11 |
2 files changed, 14 insertions, 10 deletions
diff --git a/chickadee/graphics/sprite.scm b/chickadee/graphics/sprite.scm index 3a30d49..327db67 100644 --- a/chickadee/graphics/sprite.scm +++ b/chickadee/graphics/sprite.scm @@ -142,16 +142,18 @@ void main (void) { (define %null-vec2 (vec2 0.0 0.0)) (define %default-scale (vec2 1.0 1.0)) +(define %default-shear (vec2 0.0 0.0)) (define* (draw-sprite texture position #:key - (tint white) + (blend-mode blend:alpha) (origin %null-vec2) - (scale %default-scale) + (rect (texture-gl-rect texture)) (rotation 0.0) - (blend-mode blend:alpha) - (rect (texture-gl-rect texture))) + (scale %default-scale) + (shear %default-shear) + (tint white)) "Draw TEXTURE at POSITION. Optionally, other transformations may be applied to the sprite. @@ -169,7 +171,8 @@ BLEND-MODE." #:origin origin #:position position #:rotation rotation - #:scale scale) + #:scale scale + #:shear shear) (draw-sprite* texture rect matrix #:tint tint #:blend-mode blend-mode))) diff --git a/doc/api.texi b/doc/api.texi index 469c5d7..65a7020 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -1836,16 +1836,17 @@ interface for working with sprites. Bitmaps are stored in textures @code{draw-sprite} procedure. @deffn {Procedure} draw-sprite texture position @ - [#:tint white] [#:origin] [#:scale] [#:rotation] [#:blend-mode] @ - [#:rect] + [#:blend-mode] [#:origin] [#:rect] [#:rotation] [#:scale] @ + [#:shear] [#:tint white] Draw @var{texture} at @var{position}. Optionally, other transformations may be applied to the sprite. @var{rotation} specifies the angle to rotate the sprite, in radians. -@var{scale} specifies the scaling factor as a 2D vector. All -transformations are applied relative to @var{origin}, a 2D vector, -which defaults to the lower-left corner. +@var{scale} specifies the scaling factor as a 2D vector. @var{shear} +specifies the shearing factor as a 2D vector. All transformations are +applied relative to @var{origin}, a 2D vector, which defaults to the +lower-left corner. @var{tint} specifies the color to multiply against all the sprite's pixels. By default white is used, which does no tinting at all. |