From ad578c225116d00639c139ccaec34a70800b51d2 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 26 Jan 2017 19:37:55 -0500 Subject: examples: Add nine-patch example. * examples/nine-patch.scm: New file. * examples/images/dialog-box.png: New file. * examples/AUTHORS: New file. --- examples/images/AUTHORS | 9 +++++++++ examples/images/dialog-box.png | Bin 0 -> 407 bytes examples/nine-patch.scm | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 examples/images/AUTHORS create mode 100644 examples/images/dialog-box.png create mode 100644 examples/nine-patch.scm (limited to 'examples') diff --git a/examples/images/AUTHORS b/examples/images/AUTHORS new file mode 100644 index 0000000..58442fd --- /dev/null +++ b/examples/images/AUTHORS @@ -0,0 +1,9 @@ +-*- org -*- + +* chickadee.png + By Refuzzle, CC0 + http://opengameart.org/content/winter-birds + +* dialog-box.png + By DragonDePlatino, CC BY-SA 3.0 + http://opengameart.org/content/dawnlike-16x16-universal-rogue-like-tileset-v181 diff --git a/examples/images/dialog-box.png b/examples/images/dialog-box.png new file mode 100644 index 0000000..a3b3329 Binary files /dev/null and b/examples/images/dialog-box.png differ diff --git a/examples/nine-patch.scm b/examples/nine-patch.scm new file mode 100644 index 0000000..5255d34 --- /dev/null +++ b/examples/nine-patch.scm @@ -0,0 +1,23 @@ +(use-modules (chickadee) + (chickadee math rect) + (chickadee math vector) + (chickadee render font) + (chickadee render sprite) + (chickadee render texture)) + +(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"))) + +(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." (vec2 200.0 266.0))) + +(add-hook! load-hook load) +(add-hook! draw-hook draw) +(add-hook! quit-hook abort-game) + +(run-game) -- cgit v1.2.3