2003/10/28 10:10:18
[org.ibex.core.git] / src / org / xwt / builtin / splash.xwt
1 <xwt>
2
3     <template orient="vertical" width="394" height="276" color="white">
4
5         KeyPressed += function(k) { if (k == "escape") thisbox = null; }
6
7         var progress = function(n, d) {
8             $innerbar.width = $bar.width * n / d + 1;
9             $text.text = "downloaded " + (xwt.math.ceil(100 * n/d)) + "%";
10             xwt.yield();
11         }
12
13         xwt.thread = function() {
14             xwt.window = thisbox;
15             x = (xwt.screenWidth - width) / 2;
16             y = (xwt.screenHeight - height) / 2;
17             var origin = xwt.origin;
18             if (origin.substring(0, 21) == "http://launch.xwt.org") {
19                 origin = origin.substring(22);
20                 origin = "http://" + origin.substring(origin.indexOf('/') + 1);
21             }
22             xwt.println("origin is " + origin);
23             var new_rr = xwt.unzip(xwt.watchProgress(xwt.load(origin), progress));
24             var new_xwt = xwt.clone(new_rr);
25             $text.font = xwt.fonts.vera["Vera.ttf"];
26 $text.textcolor = "#f11ff1";
27             $text.fontsize = 80;
28             $text.text = "downloading...";
29 Press1 += function() { xwt.thread = function() {
30             var img = xwt.org.xwt.builtin["splash.png"];
31             fill = img;
32             xwt.yield();
33             new_xwt.apply(xwt.box, new_xwt["main.xwt"]);
34             thisbox = null;
35 } }
36         }
37
38         <box height="236" align="bottomleft" packed="false" x="20" y="0">
39             <box fontcolor="white" id="text" shrink="true"/>
40         </box>
41         <box packed="false" id="bar" x="20" y="236" width="354" height="20" align="left">
42             <box id="innerbar" fill="blue" width="10"/>
43         </box>
44
45     </template>
46