From fe89f847503573378180ddbe5e6badec18093c37 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 13 Dec 2018 17:52:15 -0500 Subject: render: font: Include a default font for convenience. * data/fonts/good-neighbors.fnt: New file. * data/fonts/good-neighbors.png: New file. * data/CREDITS: New file. * examples/fonts/AUTHORS: Delete. * examples/fonts/good_neighbors_starling.png: Delete. * examples/fonts/good_neighbors_starling.xml: Delete. * Makefile.am (dist_pkgdata_DATA, fontsdir, dist_fonts_DATA): New variables. (EXTRA_DIST): Remove examples/fonts files. * chickadee/render/font.scm (draw-text): Make font an optional keyword argument. * doc/api.texi (Fonts): Document it. * examples/grid.scm: Update to use new draw-text API. * examples/nine-patch.scm: Ditto. * examples/text.scm: Ditto. squash! render: font: Include a default font for convenience. --- examples/fonts/AUTHORS | 5 - examples/fonts/good_neighbors_starling.png | Bin 6659 -> 0 bytes examples/fonts/good_neighbors_starling.xml | 244 ----------------------------- examples/grid.scm | 4 +- examples/nine-patch.scm | 6 +- examples/text.scm | 17 +- 6 files changed, 7 insertions(+), 269 deletions(-) delete mode 100644 examples/fonts/AUTHORS delete mode 100644 examples/fonts/good_neighbors_starling.png delete mode 100644 examples/fonts/good_neighbors_starling.xml (limited to 'examples') diff --git a/examples/fonts/AUTHORS b/examples/fonts/AUTHORS deleted file mode 100644 index 13a3415..0000000 --- a/examples/fonts/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ --*- 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 deleted file mode 100644 index 74197a6..0000000 Binary files a/examples/fonts/good_neighbors_starling.png and /dev/null differ diff --git a/examples/fonts/good_neighbors_starling.xml b/examples/fonts/good_neighbors_starling.xml deleted file mode 100644 index 0a7afde..0000000 --- a/examples/fonts/good_neighbors_starling.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/grid.scm b/examples/grid.scm index 39ad50e..6fab47a 100644 --- a/examples/grid.scm +++ b/examples/grid.scm @@ -10,7 +10,6 @@ (chickadee sdl) (sdl2 input keyboard)) -(define font #f) (define grid (make-grid)) (define item-color (make-color 0.7 0.0 0.0 0.5)) (define cell-color (make-color 0.0 0.7 0.0 0.2)) @@ -20,7 +19,6 @@ (define player-velocity #v(0.0 0.0)) (define (load) - (set! font (load-font "fonts/good_neighbors_starling.xml")) (grid-add grid 'wall-left 0 0 32 480) (grid-add grid 'wall-top 32 448 576 32) (grid-add grid 'wall-right 608 0 32 480) @@ -75,7 +73,7 @@ (for-each-cell (lambda (cell x y) (set-vec2-x! %cell-count-pos (+ (* x size) (/ size 2))) (set-vec2-y! %cell-count-pos (+ (* y size) (/ size 2))) - (draw-text font (number->string* (cell-count cell)) + (draw-text (number->string* (cell-count cell)) %cell-count-pos)) grid))) (for-each-item (lambda (item rect) diff --git a/examples/nine-patch.scm b/examples/nine-patch.scm index 7e0db1a..d20ba06 100644 --- a/examples/nine-patch.scm +++ b/examples/nine-patch.scm @@ -7,14 +7,12 @@ (chickadee sdl)) (define image #f) -(define font #f) (define (load) - (set! image (load-image "images/dialog-box.png")) - (set! font (load-font "fonts/good_neighbors_starling.xml"))) + (set! image (load-image "images/dialog-box.png"))) (define (draw alpha) (draw-nine-patch image (make-rect 192.0 192.0 256.0 96.0) #:margin 6) - (draw-text font "I am error." #v(200.0 266.0))) + (draw-text "I am error." #v(200.0 266.0))) (run-game/sdl #:load load #:draw draw) diff --git a/examples/text.scm b/examples/text.scm index 0903a90..40b7653 100644 --- a/examples/text.scm +++ b/examples/text.scm @@ -3,21 +3,12 @@ (chickadee render font) (chickadee sdl)) -(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))" + (draw-text "(draw-text font \"Hello, world!\" (vec2 100.0 200.0))" #v(100.0 200.0)) - (draw-text font "Chickadee is a game development toolkit for Guile Scheme." + (draw-text "Chickadee is a game development toolkit for Guile Scheme." #v(100.0 150.0)) - (draw-text font "The quick brown fox jumps over the lazy dog" + (draw-text "The quick brown fox jumps over the lazy dog" #v(100.0 100.0))) -(define (key-press key scan modifiers repeat?) - (when (eq? key 'q) - (abort-game))) - -(run-game/sdl #:load load #:draw draw #:key-press key-press) +(run-game/sdl #:draw draw) -- cgit v1.2.3