public void Run() { running = true; Input.Setup(); Rendering.Setup(); foreach (GameObject gameObject in GameObjects) { gameObject.Start(); } while (running) { RateLimiter.LimitRate(60); //Console.WriteLine("A frame"); Rendering.ClearScreen(); Input.CollectInput(); while (paused) { if (Input.IsKeyPressed(ConsoleKey.Spacebar)) { paused = false; break; } } for (int i = 0; i < GameObjects.Count; i++) { GameObject gameObject = GameObjects[i]; gameObject.Update(); } Overlay.Render(); Rendering.Flip(); } Rendering.Teardown(); }
public void TestClearScreen() { Rendering.Setup(mockConsole.Object); Rendering.ClearScreen(); Rendering.Flip(); testStream.Flush(); string renderOut; using (StreamReader sr = new StreamReader(testStream, Encoding.ASCII)) { sr.DiscardBufferedData(); sr.BaseStream.Seek(0, SeekOrigin.Begin); renderOut = sr.ReadToEnd(); } Rendering.Teardown(); Assert.AreEqual(5, renderOut.Split('\n').Length); }
public void TestSpriteRender_1() { Rendering.Setup(mockConsole.Object); Sprite testSprite = new Sprite("*", 1, 1); Rendering.ClearScreen(); Rendering.RenderSprite(testSprite, new DualityEngine.Mathf.Vector2Int(0, 0)); Rendering.Flip(); testStream.Flush(); string renderOut; using (StreamReader sr = new StreamReader(testStream, Encoding.ASCII)) { sr.DiscardBufferedData(); sr.BaseStream.Seek(0, SeekOrigin.Begin); renderOut = sr.ReadToEnd(); } Rendering.Teardown(); Assert.AreEqual('*', renderOut[0]); Assert.AreEqual(5, renderOut.Split('\n').Length); }