summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/font.scm14
-rw-r--r--doc/api.texi2
2 files changed, 11 insertions, 5 deletions
diff --git a/chickadee/graphics/font.scm b/chickadee/graphics/font.scm
index 6c115b9..f41b89a 100644
--- a/chickadee/graphics/font.scm
+++ b/chickadee/graphics/font.scm
@@ -38,6 +38,7 @@
#:use-module (chickadee math rect)
#:use-module (chickadee math vector)
#:use-module (chickadee graphics)
+ #:use-module (chickadee graphics color)
#:use-module (chickadee graphics gpu)
#:use-module (chickadee graphics shader)
#:use-module (chickadee graphics sprite)
@@ -435,7 +436,7 @@ extension must be either .xml or .fnt."
(let ((cursor (vec2 0.0 0.0))
(rect (make-rect 0.0 0.0 0.0 0.0)))
(lambda* (font text matrix #:key (blend-mode 'alpha)
- (start 0) (end (string-length text)))
+ (color white) (start 0) (end (string-length text)))
(let ((batches (font-sprite-batches font))
(kernings (font-kernings font)))
(define (kerning char prev)
@@ -462,7 +463,8 @@ extension must be either .xml or .fnt."
(set-rect-width! rect (vec2-x dimensions))
(set-rect-height! rect (vec2-y dimensions))
(sprite-batch-add* batch rect matrix
- #:texture-region texture))
+ #:texture-region texture
+ #:tint color))
;; Move forward to where the next character needs to be drawn.
(set-vec2-x! cursor
(+ (vec2-x cursor)
@@ -496,6 +498,7 @@ extension must be either .xml or .fnt."
position
#:key
(font (default-font))
+ (color white)
(origin %null-vec2)
(rotation 0)
(scale %default-scale)
@@ -509,5 +512,8 @@ POSITION using FONT."
#:position position
#:rotation rotation
#:scale scale)
- (draw-text* font text matrix #:blend-mode blend-mode
- #:start start #:end end))))
+ (draw-text* font text matrix
+ #:blend-mode blend-mode
+ #:color color
+ #:start start
+ #:end end))))
diff --git a/doc/api.texi b/doc/api.texi
index 7a49c85..70c3016 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -2334,7 +2334,7 @@ Return @code{#t} if @var{font} is an italicized font.
@end deffn
@deffn {Procedure} draw-text text position
- [#:font] [#:origin] [#:scale] [#:rotation] [#:blend-mode]
+ [#:font] [#:color] [#:origin] [#:scale] [#:rotation] [#:blend-mode]
[#:start 0] [#:end @code{(string-length text)}]
Draw the string @var{text} with the first character starting at