From f24c10e7fc455c092bff051d57a066d81fd77ec3 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 1 Aug 2022 16:06:49 -0400 Subject: graphics: sprite: Add #:shear argument to draw-sprite. --- chickadee/graphics/sprite.scm | 13 ++++++++----- 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. -- cgit v1.2.3