aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/05-frameset-animation.lisp
blob: a359f77e2d43f22bb06a33ec81175f81845e45bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
;;;; examples/05-frameset-animation.lisp

(defpackage #:ww.examples/5
  (:use #:cl)
  (:export #:start))

(in-package #:ww.examples/5)

(defclass frameset-example (ww::application) ())

(ww::defhandler toggle-on-click
    (ww::on-mousedown ()
      (setf (ww::runningp target)
            (not (ww::runningp target)))))

(defmethod ww::boot ((app frameset-example))
  (let ((fs
          (ww::make-frameset
           '("dude/Front_Stand.png"
             "dude/Front_Left.png"
             "dude/Front_Stand.png"
             "dude/Front_Right.png")
           :fps 3)))

    (setf (ww::x fs) 380
          (ww::y fs) 200)

    (ww::add-handler fs #'toggle-on-click)
    
    (ww::add-unit fs)))


(defun start ()
  (ww::start (make-instance
              'frameset-example
              :fps 30
              :width 800
              :height 600
              :title "Wheelwork Example: A framebased animation"
              :asset-root (merge-pathnames
                           "examples/"
                           (asdf:system-source-directory :wheelwork)))))