summaryrefslogtreecommitdiff
path: root/examples/text.scm
blob: 37ac22cd20d2854a91c7143dcbded72e744fadf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)