-
Notifications
You must be signed in to change notification settings - Fork 3
/
uitest.lisp
41 lines (36 loc) · 1.35 KB
/
uitest.lisp
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
(load (http-get "ui.lisp"))
(defvar *debug* (create-element "div"))
(setf *debug*.style.position "absolute")
(setf *debug*.style.top "20px")
(setf *debug*.style.right "20px")
(setf *debug*.style.padding "20px")
(setf *debug*.style.border "solid 1px #000000")
(setf *debug*.style.backgroundColor "#FFFF00")
(defun debug (x)
(setf *debug*.innerHTML x))
(append-child document.body *debug*)
(set-interval (lambda (&rest args)
(let ((res "<pre>"))
(labels ((visit (pfx s)
(setf res (+ res pfx ~"id={s.id}, graphics={(length s.graphics)}\n"))
(dolist (ch s.children)
(visit (+ pfx " ") ch))))
(visit "" *root*))
(debug (+ res "</pre>"))))
100)
(load (http-get "uiclock.lisp"))
(load (http-get "uichessboard.lisp"))
(make-clock 800 800)
(let ((b (make-chessboard 600 600 48)))
(let ((btn (sprite *root*)))
(load-image btn "rotate.png" 0 0)
(set-translation btn 800 200)
(setf btn.hit
(let ((t null))
(lambda (x y mode)
(cond
((= 0 mode)
(setf t (set-interval (lambda (&rest args) (rotate b 0.1))
20)))
((= 2 mode)
(setf t (clear-interval t)))))))))