using System; using System.Runtime.InteropServices; // 1ms timer resolution so the 120Hz fixed timestep's Thread.Sleep doesn't overshoot // (default ~15.6ms granularity caps the loop at 80-90 FPS; OmegaTimer did the same) [DllImport("winmm.dll")] static extern uint timeBeginPeriod(uint ms); [DllImport("winmm.dll")] static extern uint timeEndPeriod(uint ms); timeBeginPeriod(1); try { using var game = new FreedomFighter.Game1(); // debug aid: --shot [frames] renders, saves the backbuffer to a PNG, and exits var cmdArgs = Environment.GetCommandLineArgs(); for (int i = 1; i < cmdArgs.Length - 1; i++) { if (cmdArgs[i] == "--shot") { game.ShotFile = cmdArgs[i + 1]; if (i + 2 < cmdArgs.Length && int.TryParse(cmdArgs[i + 2], out int frames)) game.ShotFrames = frames; } if (cmdArgs[i] == "--level" && int.TryParse(cmdArgs[i + 1], out int level)) game.StartLevel = level; } game.Run(); } finally { timeEndPeriod(1); }