summaryrefslogtreecommitdiff
path: root/examples/text.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-01-24 20:16:08 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-01-24 21:25:20 -0500
commit233d13ca4af2fb7627926f160b9c42638ad7b333 (patch)
treeea4934154ad03d37a2ec297d3c99d2fc6a7c3b20 /examples/text.scm
parentc36193e84bb4ab93e1cacf37e010d4e484e6ce63 (diff)
render: Add bitmap font support.
* chickadee/render/font.scm: New file. * Makefile.am (SOURCES): Add it. * examples/text.scm: New file. * examples/fonts/AUTHORS: New file. * examples/fonts/good_neighbors_starling.png: New file. * examples/fonts/good_neighbors_starling.xml: New file.
Diffstat (limited to 'examples/text.scm')
-rw-r--r--examples/text.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/text.scm b/examples/text.scm
new file mode 100644
index 0000000..37ac22c
--- /dev/null
+++ b/examples/text.scm
@@ -0,0 +1,26 @@
+(use-modules (chickadee)
+ (chickadee math vector)
+ (chickadee render font))
+
+(define font #f)
+
+(define (load)
+ (set! font (load-font "fonts/good_neighbors_starling.xml")))
+
+(define (draw alpha)
+ (draw-text font "(draw-text font \"Hello, world!\" (vec2 100.0 200.0))"
+ (vec2 100.0 200.0))
+ (draw-text font "Chickadee is a game development toolkit for Guile Scheme."
+ (vec2 100.0 150.0))
+ (draw-text font "The quick brown fox jumps over the lazy dog"
+ (vec2 100.0 100.0)))
+
+(add-hook! load-hook load)
+(add-hook! draw-hook draw)
+(add-hook! quit-hook abort-game)
+(add-hook! key-press-hook
+ (lambda (key scan modifiers repeat?)
+ (when (eq? key 'q)
+ (abort-game))))
+
+(run-game)