diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-08-17 23:27:47 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-08-17 23:27:47 -0400 |
commit | 7cedd7ce6e9f474170551ea64233f08517ca0a4e (patch) | |
tree | d5a215635e337f30fec6b32186ef1a4974c955da /examples | |
parent | 94d2259dda50adec350b80931d2afdcb72156fc5 (diff) |
Update font example.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/font.scm | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/examples/font.scm b/examples/font.scm index 3bb0af0..b6fd4a1 100644 --- a/examples/font.scm +++ b/examples/font.scm @@ -1,16 +1,13 @@ (use-modules (2d game-loop) (2d window) (2d helpers) - (figl gl) - (2d wrappers ftgl)) + (2d font)) (define window-width 800) (define window-height 600) -(define font (ftgl-create-texture-font "fonts/Boxy-Bold.ttf")) +(define font (load-font "fonts/Boxy-Bold.ttf" 48)) (define text "The quick brown fox jumped over the lazy dog.") -(ftgl-set-font-face-size font 48 72) - ;; Open the window. (open-window window-width window-height) @@ -24,15 +21,14 @@ ;; Draw our sprite (define (render) - (gl-color 1 1 1) - (ftgl-render-font font text (ftgl-render-mode all))) + (let ((fps (floor (inexact->exact (current-fps))))) + (render-font font (format #f "FPS: ~d" fps) #f #f))) ;; Register callbacks. (add-hook! on-quit-hook (lambda () (quit-demo))) (add-hook! on-render-hook (lambda () (render))) (add-hook! on-key-down-hook (lambda (key mod unicode) (key-down key mod unicode))) - ;; Start the game loop. ;; The render callback will be called through this procedure. (run-game-loop) |