summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-09-06 15:01:29 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-09-06 15:01:29 -0400
commit17770f88cd46c328d9bb6517e8be4424ed0a2ab1 (patch)
tree209092821e5eaf5eb2e8fb382814404d2a145cfe
parentcd900cb6dd91c0205e0df8d79fca42699d7c8a4e (diff)
font: Define labels in terms of sprites.
* sly/font.scm (make-label): Create sprite mesh.
-rw-r--r--sly/font.scm22
1 files 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)))