From 233d13ca4af2fb7627926f160b9c42638ad7b333 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 24 Jan 2017 20:16:08 -0500 Subject: 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. --- examples/fonts/AUTHORS | 5 + examples/fonts/good_neighbors_starling.png | Bin 0 -> 6659 bytes examples/fonts/good_neighbors_starling.xml | 244 +++++++++++++++++++++++++++++ examples/text.scm | 26 +++ 4 files changed, 275 insertions(+) create mode 100644 examples/fonts/AUTHORS create mode 100644 examples/fonts/good_neighbors_starling.png create mode 100644 examples/fonts/good_neighbors_starling.xml create mode 100644 examples/text.scm (limited to 'examples') diff --git a/examples/fonts/AUTHORS b/examples/fonts/AUTHORS new file mode 100644 index 0000000..13a3415 --- /dev/null +++ b/examples/fonts/AUTHORS @@ -0,0 +1,5 @@ +-*- org -*- + +* good_neighbors_starling.png, good_neighbors_starling.xml + By PROWNE and Clint Bellanger, CC0 + http://opengameart.org/content/good-neighbors-pixel-font-starlingunity-version-updated diff --git a/examples/fonts/good_neighbors_starling.png b/examples/fonts/good_neighbors_starling.png new file mode 100644 index 0000000..74197a6 Binary files /dev/null and b/examples/fonts/good_neighbors_starling.png differ diff --git a/examples/fonts/good_neighbors_starling.xml b/examples/fonts/good_neighbors_starling.xml new file mode 100644 index 0000000..0a7afde --- /dev/null +++ b/examples/fonts/good_neighbors_starling.xml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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) -- cgit v1.2.3