From 17770f88cd46c328d9bb6517e8be4424ed0a2ab1 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 6 Sep 2014 15:01:29 -0400 Subject: font: Define labels in terms of sprites. * sly/font.scm (make-label): Create sprite mesh. --- sly/font.scm | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/sly/font.scm b/sly/font.scm index ae80263..51ae329 100644 --- a/sly/font.scm +++ b/sly/font.scm @@ -33,6 +33,7 @@ #:use-module (sly config) #:use-module (sly mesh) #:use-module (sly shader) + #:use-module (sly sprite) #:use-module (sly texture) #:use-module (sly vector) #:export (enable-fonts @@ -99,23 +100,4 @@ argument with a default value of 12." (anchor 'top-left) (color white) (shader (load-default-shader))) (let ((texture (render-text font text))) - (let ((w (texture-width texture)) - (h (texture-height texture)) - (s1 (texture-s1 texture)) - (t1 (texture-t1 texture)) - (s2 (texture-s2 texture)) - (t2 (texture-t2 texture))) - (make-mesh - #:shader shader - #:texture texture - #:indices #(0 3 2 0 2 1) - #:data `(("position" ,(vector - (vector 0 0 0) - (vector w 0 0) - (vector w h 0) - (vector 0 h 0))) - ("tex" ,(vector - (vector s1 t1) - (vector s2 t1) - (vector s2 t2) - (vector s1 t2)))))))) + (make-sprite texture #:shader shader #:anchor anchor #:color color))) -- cgit v1.2.3