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(); checkTask = new UpdateCheckTask(); checkTask.CheckForUpdatesAsync(); 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(); } if (ShouldUpdate) { Updater.Patcher.LaunchUpdateScript(); } Window.Close(); }
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.info = Window.WindowInfo; platformDrawer.Init(); string audioPath = Path.Combine(Program.AppDirectory, "audio"); BinUnpacker.Unpack(audioPath, "dig"); BinUnpacker.Unpack(audioPath, "step"); fetcher = new ResourceFetcher(); fetcher.CheckResourceExistence(); checkTask = new UpdateCheckTask(); checkTask.CheckForUpdatesAsync(); 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) { Display(); } Thread.Sleep(10); } if (Options.Load()) { LauncherSkin.SaveToOptions(); Options.Save(); } if (ShouldUpdate) { Updater.Applier.ApplyUpdate(); } if (Window.Exists) { Window.Close(); } }