From 0c28301c8fb355897cd445c30037dbfbf9e42dc4 Mon Sep 17 00:00:00 2001 From: Thomas Letan Date: Sat, 23 Jun 2018 01:49:29 +0200 Subject: [PATCH] doc: Add a new example file --- example.lisp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 example.lisp diff --git a/example.lisp b/example.lisp new file mode 100644 index 0000000..7e67753 --- /dev/null +++ b/example.lisp @@ -0,0 +1,21 @@ +(ql:quickload :fairy) + +; dealing with trivial-gamekit application initialization +(gamekit:defgame app () () + (:viewport-width 800) + (:viewport-height 600)) + +(defmethod gamekit:post-initialize ((app app)) + (gamekit:bind-button :mouse-left :released + (lambda () (gamekit:stop)))) + +(gamekit:start 'app) + +; first, we create the element of our scene, starting with the fairy root +(fairy:defroot state app) +(defvar *test-layer* (fairy:new-layer 70 0)) +(defvar *test-rec* (fairy:new-rectangle 5 5 100 150 fairy:*black*)) + +; then, we put everything together +(fairy:layer-add-child *test-layer* *test-rec*) +(fairy:root-add-child state *test-layer*) -- 2.45.2