new org.xwt.util.Semaphore().block();
} catch (Throwable e) {
+ e.printStackTrace();
Platform.criticalAbort("exception in Main.main(): " + e);
}
}
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;
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);
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() {