summaryrefslogtreecommitdiff
path: root/examples/nine-patch.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-01-26 19:37:55 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-01-26 19:37:55 -0500
commitad578c225116d00639c139ccaec34a70800b51d2 (patch)
treeea2d8d8222477f9ba23fe26a7f2e0ae8964e80d2 /examples/nine-patch.scm
parentd29f5463299493eef24c0a41b607ebae3ce3ae36 (diff)
examples: Add nine-patch example.
* examples/nine-patch.scm: New file. * examples/images/dialog-box.png: New file. * examples/AUTHORS: New file.
Diffstat (limited to 'examples/nine-patch.scm')
-rw-r--r--examples/nine-patch.scm23
1 files changed, 23 insertions, 0 deletions
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)