Exemplo n.º 1
0
        /// <summary>
        /// Initializes the DebugSystem and adds all components to the game's Components collection.
        /// </summary>
        /// <param name="game">The game using the DebugSystem.</param>
        /// <param name="debugFont">The font to use by the DebugSystem.</param>
        /// <returns>The DebugSystem for the game to use.</returns>
        public static DebugSystem Initialize(Game game, string debugFont)
        {
            // if the singleton exists, return that; we don't want two systems being created for a game
            if (singletonInstance != null)
            {
                return(singletonInstance);
            }

            // Create the system
            singletonInstance = new DebugSystem();

            // Create all of the system components
            singletonInstance.DebugManager = new DebugManager(game, debugFont);
            game.Components.Add(singletonInstance.DebugManager);

            singletonInstance.DebugCommandUI = new DebugCommandUI(game);
            game.Components.Add(singletonInstance.DebugCommandUI);

            singletonInstance.FpsCounter = new FpsCounter(game);
            game.Components.Add(singletonInstance.FpsCounter);

            singletonInstance.TimeRuler = new TimeRuler(game);
            game.Components.Add(singletonInstance.TimeRuler);

            return(singletonInstance);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the DebugSystem and adds all components to the game's Components collection.
        /// </summary>
        /// <param name="game">The game using the DebugSystem.</param>
        /// <param name="debugFont">The font to use by the DebugSystem.</param>
        /// <returns>The DebugSystem for the game to use.</returns>
        public static DebugSystem Initialize(Game game, string debugFont)
        {
            // if the singleton exists, return that; we don't want two systems being created for a game
            if (singletonInstance != null)
                return singletonInstance;

            // Create the system
            singletonInstance = new DebugSystem();

            // Create all of the system components
            singletonInstance.DebugManager = new DebugManager(game, debugFont);
            game.Components.Add(singletonInstance.DebugManager);

            singletonInstance.DebugCommandUI = new DebugCommandUI(game);
            game.Components.Add(singletonInstance.DebugCommandUI);

            singletonInstance.FpsCounter = new FpsCounter(game);
            game.Components.Add(singletonInstance.FpsCounter);

            singletonInstance.TimeRuler = new TimeRuler(game);
            game.Components.Add(singletonInstance.TimeRuler);

            return singletonInstance;
        }