2002/06/01 23:52:15
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:47:46 +0000 (06:47 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:47:46 +0000 (06:47 +0000)
darcs-hash:20040130064746-2ba56-6cd16b16e7a7a8f10d0fe01a545006d0c5073e5c.gz

CHANGES
src/org/xwt/Main.java

diff --git a/CHANGES b/CHANGES
index 12c4db0..b78b203 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 
 01-Jun megacz AWT.java: file dialog suggestion bugfix
 
+01-Jun megacz Main.java: custom splash screen support
+
index f96bdf1..d488256 100644 (file)
@@ -117,6 +117,22 @@ public class Main extends Applet {
 
             if (Log.on) Log.log(Main.class, "done loading initial xwar");
             doneDownloading = true;
+
+            MessageQueue.add(new Message() {
+                    public void perform() {
+                        Picture splash = Box.getPicture("splash");
+                        if (splash != null) {
+                            SplashScreen.splashScreenPicture = splash;
+                            SplashScreen.surf.backbuffer.drawPicture(splash, 0, 0,
+                                                                     SplashScreen.surf.backbuffer.getWidth(), SplashScreen.surf.backbuffer.getHeight(),
+                                                                     0, 0, splash.getWidth(), splash.getHeight());
+                            SplashScreen.surf.blit(SplashScreen.surf.backbuffer, 0, 0, 0, 0,
+                                                   SplashScreen.surf.backbuffer.getWidth(), SplashScreen.surf.backbuffer.getHeight());
+                            updateSplashScreen();
+                        }
+                    }
+                });
+
             initialTemplate = Template.getTemplate(instancename, null);
 
             MessageQueue.add(new Message() {
@@ -145,8 +161,9 @@ public class Main extends Applet {
 
     /** encapsulates the splash screen */
     private static class SplashScreen {
-        static Surface surf;
-        
+        public static Surface surf;
+        public static Picture splashScreenPicture;
+
         // the position of the progress bar on the splash screen
         static int barX = 5;
         static int barY = 0;
@@ -195,7 +212,13 @@ public class Main extends Applet {
 
             int barPos;
 
-            surf.backbuffer.drawPicture(splashScreenPicture, barX, barY - 20, barX + barW, barY + barH, barX, barY - 20, barX + barW, barY + barH);
+            surf.backbuffer.setClip(barX, barY - 20, barX + barW, barY + barH);
+            surf.backbuffer.drawPicture(splashScreenPicture, 0, 0,
+                                        surf.backbuffer.getWidth(), surf.backbuffer.getHeight(),
+                                        0, 0, splashScreenPicture.getWidth(), splashScreenPicture.getHeight());
+            surf.backbuffer.drawPicture(splashScreenPicture, 0, 0);
+            surf.backbuffer.setClip(0, 0, surf.backbuffer.getWidth(), surf.backbuffer.getHeight());
+
             if (!doneDownloading) {
                 float z = (float)barW / (float)2.0;
                 float x = (float) (  ((float)Resources.bytesDownloaded) / 5000000.0   );
@@ -234,8 +257,6 @@ public class Main extends Applet {
             //surf = null;
         }
 
-        private static Picture splashScreenPicture;
-
         private static String splashScreen_gif_base64_1 =
             "R0lGODlhigEUAecAAAICCBIWEi4yLkZKRhoeGj5CPgICJhIWUiYqJjo+OgYEOg4WTjI2Mg4S" +
             "EQ4OXwoODR4iHlJWVDY6NgICDgkGThYeXiouKgoSQhIWSk5STg4OJkJGQiImIhceWgICEgQC" +