public static void Run(string [] args) { long ticDelta = 0, renderDelta = 0; double fpsTime; if (closing) { return; } if (!CommandLine.Parser.Default.ParseArguments(args, options)) { GConsole.WriteLine("Fatal error: There was an error reading the argument list"); Console.Read(); return; } try { /*Data.UDMF.UDMFParser udmfParser = new Data.UDMF.UDMFParser (); * udmfParser.Setup (); * * using (var reader = new StreamReader ("TEXTMAP.txt")) * udmfParser.Parse (reader); * * Console.ReadKey (); * return;*/ GConsole.WriteLine("Core: Loading engine.PK3"); ZipLumpContainer container = null; string engPK3File = Path.GetFullPath(Path.Combine(Constants.ProgDir, @"engine.pk3")); if (File.Exists(engPK3File)) { if (ZipLumpContainer.CheckContainer(engPK3File)) { container = new ZipLumpContainer(engPK3File); } } if (container == null) { throw new FatalError(String.Format("Could not load engine.PK3. Stopping execution.")); } GConsole.WriteLine(" engine.PK3, {0} lumps", container.Count); LumpManager.AddContainer(container); GConsole.WriteLine("Core: Initializing patches"); InitPatches(); GConsole.WriteLine("Core: Generating fixed-point Sin/Cos/Atan LUTs"); FixedMath.GenerateTables(); GConsole.WriteLine("Core: Initializing video"); RenderEngine = OpenTkRenderer.Default; RenderEngine.Initialize(800, 600, false); RenderEngine.OnFocusChange += Renderer_OnFocusChange; GConsole.WriteLine("Core: Initializing playsim"); Ticker = new Ticker(); Ticker.Initialize(); GConsole.WriteLine("Core: Starting game loop"); ticClock.Reset(); ticClock.Start(); renderClock.Reset(); renderClock.Start(); while (true) { if (closing) { return; } if (ticClock.ElapsedMilliseconds >= Constants.MsecsPerTic) { ticDelta = ticClock.ElapsedMilliseconds; ticClock.Restart(); Ticker.Update(ticDelta); Input.ClearTotals(); } Input.UpdateInput(); renderDelta = renderClock.ElapsedMilliseconds; renderClock.Restart(); fpsClock.Restart(); RenderEngine.Render(renderDelta); fpsTime = fpsClock.ElapsedMilliseconds; if (RenderEngine.IsUsable()) { RenderEngine.WindowTitle = String.Format("Frame time: {0} ms", fpsTime); } } } catch (FatalError err) { DisposeResources(); GConsole.WriteLine(err.Message); Console.ReadKey(); } catch (VeryFatalError err) { DisposeResources(); GConsole.WriteLine(err.Message); Console.ReadKey(); } }