Ejemplo 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);

#if !WINDOWS_PHONE
            singletonInstance.RemoteDebugCommand = new RemoteDebugCommand(game);
            game.Components.Add(singletonInstance.RemoteDebugCommand);
#endif

            return(singletonInstance);
        }
Ejemplo n.º 2
0
        public GameDebug()
        {
            game = Program.GAME;
            font = game.Content.Load<SpriteFont>("CourierNew");
            blank = game.Content.Load<Texture2D>("teststage/blank_pixel");
            pointer = game.Content.Load<Texture2D>("permanent/cursor");

            // initialize the debug system with the game and the name of the font
            // we want to use for the debugging
            debugSystem = DebugSystem.Initialize(game, "CourierNew");

            // register a new command that lets us move a sprite on the screen
            debugSystem.DebugCommandUI.RegisterCommand(
                "pos",              // Name of command
                "set position",     // Description of command
                PosCommand          // Command execution delegate
                );
        }
Ejemplo n.º 3
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);

            #if !WINDOWS_PHONE
            singletonInstance.RemoteDebugCommand = new RemoteDebugCommand(game);
            game.Components.Add(singletonInstance.RemoteDebugCommand);
            #endif

            return singletonInstance;
        }