summaryrefslogtreecommitdiff
path: root/sly/render/font.scm
diff options
context:
space:
mode:
Diffstat (limited to 'sly/render/font.scm')
-rw-r--r--sly/render/font.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/sly/render/font.scm b/sly/render/font.scm
index f9d1a91..1312168 100644
--- a/sly/render/font.scm
+++ b/sly/render/font.scm
@@ -69,15 +69,19 @@ argument with a default value of 12."
(define %sdl-white (sdl2:make-color 255 255 255 255))
-(define (render-text font text)
+(define (render-text font text blended?)
"Return a new texture with TEXT rendered using FONT."
;; An empty string will result in a surface value of #f, in which
;; case we want to abort the texture creation process.
- (let ((surface (sdl2:render-font-blended (font-ttf font) text %sdl-white)))
+ (let ((surface ((if blended?
+ sdl2:render-font-blended
+ sdl2:render-font-solid)
+ (font-ttf font)
+ text %sdl-white)))
((@@ (sly render texture) surface->texture) surface 'linear 'linear)))
-(define* (make-label font text #:key (anchor 'top-left))
+(define* (make-label font text #:key (anchor 'top-left) (blended? #t))
"Create a sprite that displays TEXT rendered using FONT. ANCHOR
defines the sprite's origin, which is 'top-left' by default."
- (let ((texture (render-text font text)))
+ (let ((texture (render-text font text blended?)))
(make-sprite texture #:anchor anchor)))