summaryrefslogtreecommitdiff
path: root/examples/font.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-08-18 09:23:24 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-08-18 09:23:24 -0400
commit3c4d1d23a9458777f05c52fc1dae92f6467ac466 (patch)
treed7d1d4013aa9d4a44aaac04be69b0dea3eff136a /examples/font.scm
parent65424054b62c9a0bcf01a1ac2217d27365f9fd67 (diff)
Update font example.
Diffstat (limited to 'examples/font.scm')
-rw-r--r--examples/font.scm20
1 files changed, 7 insertions, 13 deletions
diff --git a/examples/font.scm b/examples/font.scm
index 79a7743..8cdfd3a 100644
--- a/examples/font.scm
+++ b/examples/font.scm
@@ -1,4 +1,5 @@
-(use-modules (2d color)
+(use-modules (figl gl)
+ (2d color)
(2d game-loop)
(2d window)
(2d helpers)
@@ -8,6 +9,7 @@
(define window-height 600)
(define font (load-font "fonts/Boxy-Bold.ttf" 48))
(define text "The quick brown fox jumped over the lazy dog.")
+(define textbox (make-textbox font text #(320 300) white 'left 200))
;; Open the window.
(open-window window-width window-height)
@@ -23,18 +25,10 @@
;; Draw our sprite
(define (render)
(let ((fps (floor (inexact->exact (current-fps)))))
- (render-font font
- (format #f "FPS: ~d" fps)
- 0
- 0
- white
- #f))
- (render-font font
- "Hello, world!"
- 320
- 300
- green
- #f))
+ (with-gl-push-matrix
+ (apply-color white)
+ (draw-font font (format #f "FPS: ~d" fps))))
+ (draw-textbox textbox))
;; Register callbacks.
(add-hook! on-quit-hook (lambda () (quit-demo)))