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