Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 private static void Update()
 {
     CalculateDeltaTime();
     Time.Update();
     GameManager.Instance.Update();
 }