예제 #1
0
파일: Game.cs 프로젝트: mrGyzzz/Certus
        // public Game() {}
        /// <summary>
        /// Prepares the game loop.
        /// </summary>
        /// <param name="ups">The desired amount of updates per second.</param>
        /// <param name="fps">The desired amount of renders per second.</param>
        /// <exception cref="System.InvalidOperationException">
        /// Thrown when the game loop has already been prepared.
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// Thrown when 'ups' is equal to or smaller than 0.
        ///  - OR - 
        /// Thrown when 'fps' is equal to or smaller than 0.
        /// </exception>
        protected void PrepareGameLoop(int ups, int fps)
        {
            if (this.m_GameTime != null)
                new InvalidOperationException("The game loop has already been prepared.");
            if (ups <= 0)
                new ArgumentException("'" + nameof(ups) + "' cannot be equal to or smaller than 0.", nameof(ups));
            if (fps <= 0)
                new ArgumentException("'" + nameof(fps) + "' cannot be equal to or smaller than 0.", nameof(fps));

            this.m_GameTime = new GameTime(ups, fps);
            Application.Idle += (sender, arguments) => this.Run();
        }
예제 #2
0
파일: Game.cs 프로젝트: mrGyzzz/Certus
 /// <summary>
 /// Reports the game's current state.
 /// </summary>
 protected virtual void Report(GameTime time)
 {
 }