From 499a07155e137c40589b8c8383ffa6c942ce15d6 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 2 May 2017 22:38:25 -0400 Subject: Add buffer module. * chickadee/buffer.scm: New file. * Makefile.am (SOURCES): Add it. * .dir-locals.el: Add indent rules for with-buffer and with-current-buffer. * examples/buffer.scm: New file. * doc/api.texi (Buffers): Add docs. --- examples/buffer.scm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/buffer.scm (limited to 'examples') diff --git a/examples/buffer.scm b/examples/buffer.scm new file mode 100644 index 0000000..4712ea4 --- /dev/null +++ b/examples/buffer.scm @@ -0,0 +1,33 @@ +(use-modules (chickadee) + (chickadee buffer) + (chickadee math vector) + (chickadee render font) + (chickadee render sprite) + (chickadee render texture) + (chickadee scripting) + (oop goops)) + +(define-class () + (chickadee #:accessor chickadee #:init-value #f)) + +(define-method (start (splash )) + (set! (chickadee splash) (load-image "images/chickadee.png")) + (after 120 (replace-buffer! (make )))) + +(define-method (draw (splash ) alpha) + (draw-sprite (chickadee splash) (vec2 256.0 176.0))) + +(define-class () + (font #:accessor menu-font #:init-value #f)) + +(define-method (start (menu )) + (set! (menu-font menu) (load-font "fonts/good_neighbors_starling.xml"))) + +(define-method (draw (menu ) alpha) + (draw-text (menu-font menu) "press any key to exit" (vec2 200.0 240.0))) + +(define-method (key-press (menu ) key scancode modifiers repeat?) + (pop-buffer!)) + +(use-buffers! (make )) +(run-game) -- cgit v1.2.3