~lthms/fairy.lisp

0c28301c8fb355897cd445c30037dbfbf9e42dc4 — Thomas Letan 6 years ago b702365
doc: Add a new example file
1 files changed, 21 insertions(+), 0 deletions(-)

A example.lisp
A example.lisp => example.lisp +21 -0
@@ 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*)