summaryrefslogtreecommitdiff
path: root/examples/text.scm
diff options
context:
space:
mode:
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)