DebugManager class that holds graphics resources for debug.
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Example #1
0
        public static void Initialize(Game g)
        {
            _debugManager = new DebugManager(g);
            g.Components.Add(_debugManager);

            _debugCommandUI = new DebugCommandUI(g);
            _debugCommandUI.DrawOrder = int.MaxValue;
            g.Components.Add(_debugCommandUI);

            _fpsCounter = new FpsCounter(g);
            g.Components.Add(_fpsCounter);

            _memTracker = new MemoryTracker(g);
            g.Components.Add(_memTracker);

            _currentRuler = new TimeRuler(g);
            g.Components.Add(_currentRuler);

            _timeHistory = new TimeHistory(g, _currentRuler);
            g.Components.Add(_timeHistory);
        }
Example #2
0
        public override void Initialize()
        {
            // Get debug manager from game service.
            debugManager =
                Game.Services.GetService(typeof(DebugManager)) as DebugManager;

            if (debugManager == null)
                throw new InvalidOperationException("DebugManaer is not registered.");

            // Register 'fps' command if debug command is registered as a service.
            IDebugCommandHost host =
                                Game.Services.GetService(typeof(IDebugCommandHost))
                                                                as IDebugCommandHost;

            if (host != null) {
                host.RegisterCommand("th", "Time History", this.CommandExecute);
                Visible = false;
            }

            // Initialize parameters.
            stringBuilder.Length = 0;

            InitializeHistory();

            base.Initialize();
        }
Example #3
0
        public override void Initialize()
        {
            // Get debug manager from game service.
            debugManager =
                Game.Services.GetService( typeof( DebugManager ) ) as DebugManager;

            if ( debugManager == null )
                throw new InvalidOperationException( "DebugManaer is not registered." );

            // Register 'fps' command if debug command is registered as a service.
            IDebugCommandHost host =
                                Game.Services.GetService( typeof(IDebugCommandHost) )
                                                                as IDebugCommandHost;

            if ( host != null )
            {
                host.RegisterCommand( "fps", "FPS Counter", this.CommandExecute );
                Visible = false;
            }

            // Initialize parameters.
            Fps = 0;
            sampleFrames = 0;
            stopwatch = Stopwatch.StartNew();
            stringBuilder.Length = 0;

            base.Initialize();
        }
Example #4
0
        public override void Initialize()
        {
            // Get debug manager from game service.
            debugManager = Game.Services.GetService(typeof(DebugManager)) as DebugManager;

            if (debugManager == null)
                throw new InvalidOperationException("DebugManaer is not registered.");

            // Register 'fps' command if debug command is registered as a service.
            IDebugCommandHost host = Game.Services.GetService(typeof(IDebugCommandHost)) as IDebugCommandHost;

            if (host != null) {
                host.RegisterCommand("memory", "Memory Tracker", this.CommandExecute);
                Visible = false;
            }

            // Initialize parameters.
            Collections = 0;
            ManagedHeapSize = GC.GetTotalMemory(false);
            ManagedHeapDelta = 0;
            stopwatch = Stopwatch.StartNew();

            stringBuilder.Length = 0;

            base.Initialize();
        }
Example #5
0
        public override void Initialize()
        {
            #if TRACE
            debugManager =
                Game.Services.GetService( typeof( DebugManager ) ) as DebugManager;

            if ( debugManager == null )
                throw new InvalidOperationException( "DebugManager is not registered." );

            // Add "tr" command if DebugCommandHost is registered.
            IDebugCommandHost host =
                                Game.Services.GetService( typeof( IDebugCommandHost ) )
                                                                    as IDebugCommandHost;

            if ( host != null )
            {
                host.RegisterCommand( "tr", "TimeRuler", this.CommandExecute );
                this.Visible = false;
                this.Enabled = false;
            }

            // Initialize Parameters.
            logs = new FrameLog[2];
            for ( int i = 0; i < logs.Length; ++i )
                logs[i] = new FrameLog();

            sampleFrames = TargetSampleFrames = 1;
            #endif
            base.Initialize();
        }
Example #6
0
        /// <summary>
        /// Initialize component
        /// </summary>
        public override void Initialize()
        {
            debugManager =
                Game.Services.GetService( typeof( DebugManager ) ) as DebugManager;

            if ( debugManager == null )
                throw new InvalidOperationException( "Coudn't find DebugManager." );

            base.Initialize();
        }