2002/04/27 03:39:38
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:45:22 +0000 (06:45 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:45:22 +0000 (06:45 +0000)
darcs-hash:20040130064522-2ba56-70d9a2ccc2d65af4918c1132cb7592089abe3feb.gz

CHANGES
src/org/xwt/Main.java

diff --git a/CHANGES b/CHANGES
index 30e22e9..bd4a9c9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -32,4 +32,6 @@
 
 22-Apr megacz README: included instructions on how to build without gcc.
 
+26-Apr megacz src/org/xwt/Main.java: included text description on splash screen
+
 
index d5e482f..0165f4c 100644 (file)
@@ -119,6 +119,7 @@ public class Main extends Applet {
             new org.xwt.util.Semaphore().block();
 
         } catch (Throwable e) {
+            e.printStackTrace();
             Platform.criticalAbort("exception in Main.main(): " + e);
         }
     }
@@ -131,7 +132,7 @@ public class Main extends Applet {
         static Surface surf;
         
         // the position of the progress bar on the splash screen
-        static int barX = 10;
+        static int barX = 5;
         static int barY = 0;
         static int barW = 0;
         static int barH = 10;
@@ -147,8 +148,8 @@ public class Main extends Applet {
             
             if (gif == null) Platform.criticalAbort("error loading splash screen image");
             splashScreenPicture = Platform.createPicture(gif.getData(), gif.getWidth(), gif.getHeight());
-            barY = splashScreenPicture.getHeight() - 20;
-            barW = splashScreenPicture.getWidth() - 20;            
+            barY = splashScreenPicture.getHeight() - 15;
+            barW = splashScreenPicture.getWidth() - 10;
             
             Box box = new Box("box", null);
             surf = Platform.createSurface(box, false, false);
@@ -162,22 +163,38 @@ public class Main extends Applet {
             surf.blit(surf.backbuffer, 0, 0, 0, 0, splashScreenPicture.getWidth(), splashScreenPicture.getHeight());
         }
         
+        static long lastupdate = 0;
         static void update() {
             if (surf == null) return;
+
+            long now = System.currentTimeMillis();
+            if (now - lastupdate < 100) return;
+            lastupdate = now;
+
             int barPos;
+
+            surf.backbuffer.drawPicture(splashScreenPicture, barX, barY - 20, barX + barW, barY + barH, barX, barY - 20, barX + barW, barY + barH);
             if (!doneDownloading) {
                 float z = (float)barW / (float)2.0;
                 float x = (float) (  ((float)Resources.bytesDownloaded) / 5000000.0   );
                 barPos = (int)   (  z - (1.0 / ( x + 1.0 / z ))  );
+                String bytes = Resources.bytesDownloaded < 1024 ?
+                    (Resources.bytesDownloaded + " bytes ") :
+                    (Resources.bytesDownloaded / 1024) + "kb ";
+                surf.backbuffer.drawString(Platform.getDefaultFont(), "downloading user interface: " + bytes + "recieved",
+                                           barX, barY - 5, 0xffffffff);
             } else {
                 barPos = barW / 2 + (instantiatedUnits * barW) / (initialTemplate.numUnits() * 2);
+                surf.backbuffer.drawString(Platform.getDefaultFont(), "loading user interface: " +
+                                           ((instantiatedUnits * 100) / (initialTemplate.numUnits())) + 
+                                           "% complete", barX, barY - 5, 0xffffffff);
             }
             if (barPos > barW) barPos = barW;
-            
+
             surf.backbuffer.fillRect(barX, barY, barPos + barX, barH + barY, 0xFF363a86);
             surf.backbuffer.fillRect(barX + 1, barY + 1, barPos - 1 + barX + 1, barH - 1 + barY + 1, 0xFF000036);
             surf.backbuffer.fillRect(barX + 1, barY + 1, barPos - 2 + barX + 1, barH - 2 + barY + 1, 0xFF101350);
-            surf.blit(surf.backbuffer, barX, barY, barX, barY, barPos + barX, barH + barY);
+            surf.blit(surf.backbuffer, barX, barY - 20, barX, barY - 20, barW + barX, barH + barY);
         }
 
         static void dispose() {