summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
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