Beispiel #1
0
        /// <summary>
        /// Create a game instance and run it.
        /// </summary>
        /// <param name="onLoad">The callback that will be called in the <see cref="Game.LoadContent"/> method.</param>
        /// <param name="onBeforeUpdate">The callback that will be called before each <see cref="GameBase.Update"/> calls.</param>
        /// <param name="onAfterUpdate">The callback that will be called after each <see cref="GameBase.Update"/> calls.</param>
        /// <param name="onBeforeDraw">The callback that will be called before each <see cref="GameBase.Draw"/> calls.</param>
        /// <param name="onAfterDraw">The callback that will be called before each <see cref="GameBase.Draw"/> calls.</param>
        static public void CreateAndRunGame(Action <Game> onLoad, Action <Game> onBeforeUpdate, Action <Game> onAfterUpdate = null, Action <Game> onBeforeDraw = null, Action <Game> onAfterDraw = null)
        {
            using (var game = new GameClassForTests())
            {
                game.LoadingContent += onLoad;
                game.BeforeUpdating += onBeforeUpdate;
                game.AfterUpdating  += onAfterUpdate;
                game.BeforeDrawing  += onBeforeDraw;
                game.AfterDrawing   += onAfterDraw;

                game.Run();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a game instance and run it.
        /// </summary>
        /// <param name="onLoad">The callback that will be called in the <see cref="Game.LoadContent"/> method.</param>
        /// <param name="onBeforeUpdate">The callback that will be called before each <see cref="GameBase.Update"/> calls.</param>
        /// <param name="onAfterUpdate">The callback that will be called after each <see cref="GameBase.Update"/> calls.</param>
        /// <param name="onBeforeDraw">The callback that will be called before each <see cref="GameBase.Draw"/> calls.</param>
        /// <param name="onAfterDraw">The callback that will be called before each <see cref="GameBase.Draw"/> calls.</param>
        static public void CreateAndRunGame(Action<Game> onLoad, Action<Game> onBeforeUpdate, Action<Game> onAfterUpdate = null, Action<Game> onBeforeDraw = null, Action<Game> onAfterDraw = null)
        {
            using (var game = new GameClassForTests())
            {
                game.LoadingContent += onLoad;
                game.BeforeUpdating += onBeforeUpdate;
                game.AfterUpdating += onAfterUpdate;
                game.BeforeDrawing += onBeforeDraw;
                game.AfterDrawing += onAfterDraw;

                game.Run();
            }
        }