summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-03-29 16:19:01 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-03-29 16:19:01 -0400
commitbd4e7ca64ed3d203ab7c938387d7ab32df8e5f23 (patch)
tree5e108c1b175e87af9e820541af23501f17bc5816 /2d
parent40bacd7e2ba29a1813a8fcd8070cf9ea4a9abca8 (diff)
Don't load font shaders upon importing (2d font) module.
* 2d/font.scm (font-shader): Set to #f initially. (enable-fonts): New procedure. * examples/font.scm: Enable fonts.
Diffstat (limited to '2d')
-rw-r--r--2d/font.scm25
1 files changed, 15 insertions, 10 deletions
diff --git a/2d/font.scm b/2d/font.scm
index 4e9d401..5cdc9cf 100644
--- a/2d/font.scm
+++ b/2d/font.scm
@@ -36,7 +36,8 @@
#:use-module (2d vector2)
#:use-module (2d window)
#:use-module (2d wrappers gl)
- #:export (load-font
+ #:export (enable-fonts
+ load-font
load-default-font
font?
font-point-size
@@ -48,12 +49,23 @@
label-color
draw-label))
-(SDL:ttf-init)
-
;;;
;;; Font
;;;
+(define font-shader #f)
+
+(define (enable-fonts)
+ (SDL:ttf-init)
+ (set! font-shader
+ (make-shader-program
+ (load-vertex-shader
+ (string-append %pkgdatadir
+ "/shaders/font-vertex.glsl"))
+ (load-fragment-shader
+ (string-append %pkgdatadir
+ "/shaders/font-fragment.glsl")))))
+
(define-record-type <font>
(make-font ttf point-size)
font?
@@ -131,13 +143,6 @@ white and ANCHOR with a default of 'top-left."
(anchor (anchor-texture texture anchor)))
(%make-label font text position anchor color texture vertices)))
-(define font-shader
- (make-shader-program
- (load-vertex-shader (string-append %pkgdatadir
- "/shaders/font-vertex.glsl"))
- (load-fragment-shader (string-append %pkgdatadir
- "/shaders/font-fragment.glsl"))))
-
(define (draw-label label)
"Draw LABEL on the screen."
(with-shader-program font-shader