public void Run() { do { Input.Reset(); if (WindowResized()) { Reset(Console.WindowWidth, Console.WindowHeight); } // Set up size and position of tombstone int tombstoneTopLeftY = (int)(height - tombstoneTopPosition * height); int tombstoneWidth = Math.Max(playerName.Length, tombstoneRIPTextWidth) + 4; int tombstoneTopLeftX = width / 2 - tombstoneWidth / 2; ConsoleUI.ClearBuffer(); DrawGrass(tombstoneTopLeftY); DrawTombstone(tombstoneTopLeftX, tombstoneTopLeftY, tombstoneWidth); DrawRain(); DrawLightning(); ConsoleUI.Render(); Input.CheckForKeyPress(); press = Input.ReadKey().Key; } while (press != ConsoleKey.Enter); }
/// <summary> /// Drawing loop for the logo. Pressing [enter] will break out. /// </summary> public void Run() { do { Input.Reset(); if (WindowResized()) { Reset(Console.WindowWidth, Console.WindowHeight); } SeedBottomPoints(); SmoothPoints(); DrawPoints(); DrawLogo(); ConsoleUI.Render(); ShiftPoints(); FadePoints(); ConsoleUI.Render(); Input.CheckForKeyPress(); press = Input.ReadKey().Key; } while (press != ConsoleKey.Enter); }
public int Loop() { double dt = 0.0; while (isRunning) { dt = Time.deltaMs; Input.CheckForKeyPress(); press = Input.ReadKey().Key; if (press == ConsoleKey.Escape) { isRunning = false; } CheckForResize(); Update(); // Milliseconds per frame in the bottom left corner of screen. // (This is better than FPS), FPS is for noobs. #if DEBUG ConsoleUI.Write(0, 0, "Hit the 'D' key to swap from debug view to game view", Color.Gold); ConsoleUI.Write(0, 1, dt.ToString() + " ms/frame", Color.Gold); ConsoleUI.Write(0, 2, (1.0 / dt * 1000.0).ToString() + " fps", Color.Gold); #endif Render(); Input.Reset(); Time.Update(); } return(0); }