/
workbench.lisp
30 lines (26 loc) · 1.24 KB
/
workbench.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
(in-package #:trial)
(define-pool workbench
:base 'trial)
(progn
(defmethod setup-scene ((main main) scene)
(let ((window (make-instance 'trial-ui::ui-window
:name :ui
:extent (vec4 0 0 (width *context*) (height *context*))
:layout (make-instance 'trial-ui::horizontal-layout :alignment :top)))
(context (make-instance 'trial-ui::ui-context)))
(enter (make-instance 'trial-ui::spacer :preferred-size (vec 0.1 0.1)) window)
(enter (make-instance 'trial-ui::text-field :text "1" :size 48) window)
(enter (make-instance 'trial-ui::spacer :preferred-size (vec 0.1 0.1)) window)
(enter (make-instance 'trial-ui::label :text "2") window)
(enter (make-instance 'trial-ui::spacer :preferred-size (vec 0.1 0.1)) window)
(enter window scene)
(enter window context)
(add-handler context scene))
(enter (make-instance '2d-camera) scene)
(enter (make-instance 'render-pass) scene))
(maybe-reload-scene))
(define-handler (controller resize) (ev width height)
(let ((ui (unit :ui *loop*)))
(setf (vz (extent ui)) width)
(setf (vw (extent ui)) height)
(trial-ui::note-extent-change ui nil)))