예제 #1
0
        internal void TryLoadTexturePack()
        {
            Options.Load();
            LauncherSkin.LoadFromOptions();
            string texDir  = Path.Combine(Program.AppDirectory, "texpacks");
            string texPack = Options.Get(OptionsKey.DefaultTexturePack) ?? "default.zip";

            texPack = Path.Combine(texDir, texPack);

            if (!File.Exists(texPack))
            {
                texPack = Path.Combine(texDir, "default.zip");
            }
            if (!File.Exists(texPack))
            {
                return;
            }

            using (Stream fs = new FileStream(texPack, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                ZipReader reader = new ZipReader();

                reader.ShouldProcessZipEntry = (f) => f == "default.png";
                reader.ProcessZipEntry       = ProcessZipEntry;
                reader.Extract(fs);
            }
        }
예제 #2
0
 void ResetColours()
 {
     LauncherSkin.ResetToDefault();
     widgetIndex = 0;
     using ( drawer ) {
         drawer.SetBitmap(game.Framebuffer);
         MakeAllRGBTriplets(true);
     }
     widgetIndex = widgets.Length;
     game.MakeBackground();
     Resize();
 }
예제 #3
0
        public void Run()
        {
            Window = new NativeWindow(640, 400, Program.AppName, 0,
                                      GraphicsMode.Default, DisplayDevice.Default);
            Window.Visible = true;
            Drawer         = new GdiPlusDrawer2D(null);
            Init();
            TryLoadTexturePack();
            platformDrawer.Init(Window.WindowInfo);

            fetcher = new ResourceFetcher();
            fetcher.CheckResourceExistence();
            if (!fetcher.AllResourcesExist)
            {
                SetScreen(new ResourcesScreen(this));
            }
            else
            {
                SetScreen(new MainScreen(this));
            }

            while (true)
            {
                Window.ProcessEvents();
                if (!Window.Exists)
                {
                    break;
                }
                if (ShouldExit)
                {
                    if (Screen != null)
                    {
                        Screen.Dispose();
                    }
                    break;
                }

                Screen.Tick();
                if (Dirty || Screen.Dirty)
                {
                    Display();
                }
                Thread.Sleep(1);
            }

            if (Options.Load())
            {
                LauncherSkin.SaveToOptions();
                Options.Save();
            }
            Window.Close();
        }