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(); }
/// <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(); }
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; } // Initialize Parameters. logs = new FrameLog[2]; for (int i = 0; i < logs.Length; ++i) logs[i] = new FrameLog(); sampleFrames = TargetSampleFrames = 1; // Time-Ruler's update method doesn't need to get called. this.Enabled = false; #endif base.Initialize(); }