##// END OF EJS Templates
Use flex in html
naryl -
r10:a65783dd default
parent child Browse files
Show More
@@ -1,5 +1,6 b''
1
1
2 * Windows GUI
2 * Windows GUI
3 * Save-load game
3 * Resizable frames
4 * Resizable frames
4 * Build Istreblenie
5 * Build Istreblenie
5 ** modifying it to suit compiler specifics
6 ** modifying it to suit compiler specifics
@@ -1,7 +1,12 b''
1
1
2 <div id="qsp">
2 <div id="qsp">
3 <div id="qsp-main" class="qsp-frame">&nbsp;</div>
3 <div class="qsp-col qsp-col1">
4 <div id="qsp-acts" class="qsp-frame">&nbsp;</div>
4 <div id="qsp-main" class="qsp-frame">&nbsp;</div>
5 <div id="qsp-stat" class="qsp-frame">&nbsp;</div>
5 <div id="qsp-acts" class="qsp-frame">&nbsp;</div>
6 <div id="qsp-objs" class="qsp-frame">&nbsp;</div>
6 <input id="qsp-input" class="qsp-frame">
7 </div>
8 <div class="qsp-col qsp-col2">
9 <div id="qsp-stat" class="qsp-frame">&nbsp;</div>
10 <div id="qsp-objs" class="qsp-frame">&nbsp;</div>
11 </div>
7 </div>
12 </div>
@@ -2,45 +2,50 b''
2 .qsp-frame {
2 .qsp-frame {
3 border: 1px solid black;
3 border: 1px solid black;
4 overflow: auto;
4 overflow: auto;
5 position: absolute;
6 padding: 5px;
5 padding: 5px;
7 box-sizing: border-box;
6 box-sizing: border-box;
8 }
7 }
9
8
10 #qsp {
9 #qsp {
11 position: fixed;
10 position: absolute;
11 display: flex;
12 flex-flow: row;
12 top: 0;
13 top: 0;
13 left: 0;
14 left: 0;
14 width: 100%;
15 width: 100%;
15 height: 100%;
16 height: 100%;
16 }
17 }
17
18
19 .qsp-col {
20 display: flex;
21 flex-flow: column;
22 }
23
24 .qsp-col1 {
25 flex: 7 7 70px;
26 }
27
28 .qsp-col2 {
29 flex: 3 3 30px;
30 }
31
18 #qsp-main {
32 #qsp-main {
19 height: 60%;
33 flex: 6 6 60px;
20 width: 70%;
21 top: 0;
22 left: 0;
23 }
34 }
24
35
25 #qsp-acts {
36 #qsp-acts {
26 height: 40%;
37 flex: 4 4 40px;
27 width: 70%;
38 }
28 bottom: 0;
39
29 left: 0;
40 #qsp-input {
30 }
41 }
31
42
32 #qsp-stat {
43 #qsp-stat {
33 height: 50%;
44 flex: 5 5 50px;
34 width: 30%;
35 top: 0;
36 right: 0;
37 }
45 }
38
46
39 #qsp-objs {
47 #qsp-objs {
40 height: 50%;
48 flex: 5 5 50px;
41 width: 30%;
42 bottom: 0;
43 right: 0;
44 }
49 }
45
50
46 .qsp-act {
51 .qsp-act {
@@ -15,10 +15,13 b''
15 title
15 title
16 "</a>"))
16 "</a>"))
17
17
18 ;;; Startup
18 ;; To be used in saving game
19
19 (defm (root api stash-state) ()
20 (defm (root api init-dom) ()
20 (setf (root state-stash)
21 )
21 (ps:create vars (root vars)
22 objs (root objs)
23 next-location (root current-location)))
24 (values))
22
25
23 ;;; Misc
26 ;;; Misc
24
27
@@ -17,6 +17,7 b''
17 (api-call clear-act)
17 (api-call clear-act)
18 (api-call init-args args)
18 (api-call init-args args)
19 (setf (root current-location) target)
19 (setf (root current-location) target)
20 (api-call stash-state)
20 (funcall (ps:getprop (root locations) (ps:chain target (to-upper-case)))))
21 (funcall (ps:getprop (root locations) (ps:chain target (to-upper-case)))))
21
22
22 ;;; 2var
23 ;;; 2var
@@ -145,13 +146,13 b''
145 ;;; 8sub
146 ;;; 8sub
146
147
147 (defm (root lib gosub) (target &rest args)
148 (defm (root lib gosub) (target &rest args)
148 (conserving-vars (args $args result $result)
149 (conserving-vars (args result)
149 (api-call init-args args)
150 (api-call init-args args)
150 (funcall (ps:getprop (root locations) target))
151 (funcall (ps:getprop (root locations) target))
151 (values)))
152 (values)))
152
153
153 (defm (root lib func) (target &rest args)
154 (defm (root lib func) (target &rest args)
154 (conserving-vars (args $args result $result)
155 (conserving-vars (args result)
155 (api-call init-args args)
156 (api-call init-args args)
156 (funcall (ps:getprop (root locations) target))
157 (funcall (ps:getprop (root locations) target))
157 (api-call get-result)))
158 (api-call get-result)))
@@ -161,13 +162,13 b''
161 ;;; 10dynamic
162 ;;; 10dynamic
162
163
163 (defm (root lib dyneval) (block &rest args)
164 (defm (root lib dyneval) (block &rest args)
164 (conserving-vars (args $args result $result)
165 (conserving-vars (args result)
165 (api-call init-args args)
166 (api-call init-args args)
166 (funcall block)
167 (funcall block)
167 (api-call get-result)))
168 (api-call get-result)))
168
169
169 (defm (root lib dynamic) (&rest args)
170 (defm (root lib dynamic) (&rest args)
170 (conserving-vars (args $args result $result)
171 (conserving-vars (args result)
171 (api-call init-args args)
172 (api-call init-args args)
172 (funcall block)
173 (funcall block)
173 (values)))
174 (values)))
@@ -189,7 +190,7 b''
189 (api-call get-text :main))
190 (api-call get-text :main))
190
191
191 (defm (root lib desc) (s)
192 (defm (root lib desc) (s)
192 (api-call report-error "DESC is not supported"))
193 "")
193
194
194 (defm (root lib main-clear) ()
195 (defm (root lib main-clear) ()
195 (api-call clear-text :main))
196 (api-call clear-text :main))
@@ -4,12 +4,12 b''
4 (setf (root)
4 (setf (root)
5 (ps:create vars (ps:create)
5 (ps:create vars (ps:create)
6 objs (list)
6 objs (list)
7 state-stash (ps:create)
7 acts (ps:create)
8 acts (ps:create)
8 locations (ps:create)))
9 locations (ps:create)))
9
10
10 (setf window.onload
11 (setf window.onload
11 (lambda ()
12 (lambda ()
12 (api-call init-dom)
13 (funcall (ps:getprop (root locations)
13 (funcall (ps:getprop (root locations)
14 (ps:chain *object (keys (root locations)) 0)))
14 (ps:chain *object (keys (root locations)) 0)))
15 (values)))
15 (values)))
@@ -17,18 +17,17 b''
17 `(ps:chain ,obj (has-own-property ,key)))
17 `(ps:chain ,obj (has-own-property ,key)))
18
18
19 (ps:defpsmacro conserving-vars (vars &body body)
19 (ps:defpsmacro conserving-vars (vars &body body)
20 "Calls body with safely stored away VARS, and restores their values after that returning what BODY returns."
20 "Calls body with safely stored away VARS (whole arrays, both namespaces), and restores their values after that returning what BODY returns."
21 `(let ((__conserved (list ,@(loop :for var :in vars
21 `(let ((__conserved (list ,@(loop :for var :in vars
22 :collect `(var ,var 0)))))
22 :collect `(root vars ,var)))))
23 ,@(loop :for var :in vars
23 ,@(loop :for var :in vars
24 :collect `(set (var ,var 0) ,(if (char= #\$ (elt (string var) 0))
24 :collect `(setf (root vars ,var) (ps:create :num 0 :str "")))
25 "" 0)))
26 (unwind-protect
25 (unwind-protect
27 (progn ,@body)
26 (progn ,@body)
28 (progn
27 (progn
29 ,@(loop :for var :in vars
28 ,@(loop :for var :in vars
30 :for i from 0
29 :for i from 0
31 :collect `(set (var ,var 0) (ps:@ __conserved ,i)))))))
30 :collect `(setf (root vars ,var) (ps:@ __conserved ,i)))))))
32
31
33 ;;; Common
32 ;;; Common
34
33
General Comments 0
You need to be logged in to leave comments. Login now