if (args[startargs].startsWith("http://")) {
if (Log.on) Log.log(Main.class, "downloading xwar");
URL u = new URL(args[startargs]);
- originAddr = InetAddress.getByName(u.getHost());
- Resources.loadArchive(Platform.urlToInputStream(u));
+ try {
+ originAddr = InetAddress.getByName(u.getHost());
+ // FIXME: use XMLRPC resolver?
+ } catch (UnknownHostException e) {
+ if (Log.on) Log.log(Main.class, "couldn't resolve " + u.getHost() + " -- hopefully there is a proxy that can");
+ }
+ Resources.loadArchive(new HTTP(args[startargs]).getInputStream());
} else {
String bytes = Resources.bytesDownloaded < 1024 ?
(Resources.bytesDownloaded + " bytes ") :
(Resources.bytesDownloaded / 1024) + "kb ";
- surf.backbuffer.drawString(Platform.getDefaultFont(), "downloading user interface: " + bytes + "recieved",
+ surf.backbuffer.drawString(Platform.getDefaultFont(), "downloading user interface: " + bytes + "received",
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())) +
+ surf.backbuffer.drawString(Platform.getDefaultFont(), "initializing user interface: " +
+ Math.min(100, (instantiatedUnits * 100) / (initialTemplate.numUnits())) +
"% complete", barX, barY - 5, 0xffffffff);
}
if (barPos > barW) barPos = barW;
+ // for some reason, the clip keeps getting set on Java2 under Windows -- so we unset it
+ surf.backbuffer.setClip(0, 0, surf.backbuffer.getWidth(), surf.backbuffer.getHeight());
+
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);
+
+ // This is really ugly, but unfortunately it's the only way -- the MessageQueue is all clogged up with the
+ // initial instantiation. This takes care of blitting regions dirtied on the screen.
+ surf.blitDirtyScreenRegions();
surf.blit(surf.backbuffer, barX, barY - 20, barX, barY - 20, barW + barX, barH + barY);
}