public override void Initialize() { // デバッグマネージャーをゲームのサービスから取得 debugManager = Game.Services.GetService(typeof(DebugManager)) as DebugManager; if (debugManager == null) throw new InvalidOperationException("DebugManaerが登録されていません"); // デバッグコマンドがサービスに登録されているなら、FPSコマンドを登録する IDebugCommandHost host = Game.Services.GetService(typeof(IDebugCommandHost)) as IDebugCommandHost; if (host != null) { host.RegisterCommand("fps", "FPS Counter", this.CommandExecute); Visible = false; } // パラメーターの初期化 Fps = 0; sampleFrames = 0; stopwatch = Stopwatch.StartNew(); stringBuilder.Length = 0; base.Initialize(); }
DebugSampleAccessor(Game game) { DebugManager = new DebugManager(game); game.Components.Add(DebugManager); TimeRuler = new TimeRuler(game); game.Components.Add(TimeRuler); }
/// <summary> /// ゲームが実行を開始する前に必要な初期化を行います。 /// ここで、必要なサービスを照会して、関連するグラフィック以外のコンテンツを /// 読み込むことができます。base.Initialize を呼び出すと、使用するすべての /// コンポーネントが列挙されるとともに、初期化されます。 /// </summary> protected override void Initialize() { // デバッグマネージャーの初期化と追加 debugManager = new DebugManager(this); Components.Add(debugManager); // デバッグマコマンドUIの初期化と追加 debugCommandUI = new DebugCommandUI(this); // デバッグコマンドUIを最上面に表示させる為にDrawOrderを変更する debugCommandUI.DrawOrder = 100; Components.Add(debugCommandUI); // FPSカウンターの初期化と追加 fpsCounter = new FpsCounter(this); Components.Add(fpsCounter); fpsCounter.Visible = true; // タイムルーラーの初期化と追加 timerRuler = new TimeRuler(this); Components.Add(timerRuler); timerRuler.Visible = true; timerRuler.ShowLog = true; #if WINDOWS || XBOX // リモートデバッグコマンド「remote」の追加 Components.Add(new RemoteDebugCommand(this)); #endif //デバッグコマンドに物理エンジンの剛体描画のコマンド追加 debugCommandUI.RegisterCommand("physics", "Phisics Debug Draw", (host, command, arguments) => { if (arguments.Count == 0) DebugDrawVisible = !DebugDrawVisible; else { foreach (string arg in arguments) { switch (arg.ToLower()) { case "on": DebugDrawVisible = true; break; case "off": DebugDrawVisible = false; break; } } } }); base.Initialize(); }
public ZombieCraft() { _instance = this; Content.RootDirectory = "Content"; graphics = new GraphicsDeviceManager( this ); IsFixedTimeStep = false; //TargetElapsedTime = TimeSpan.FromSeconds( 1d / 30d ); graphics.SynchronizeWithVerticalRetrace = true; #if WINDOWS IsMouseVisible = true; graphics.PreferredBackBufferWidth = 853; graphics.PreferredBackBufferHeight = 480; #else graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; #endif // Create the screen manager component. screenManager = new ScreenManager( this ); Components.Add( screenManager ); //// Activate the first screens. screenManager.AddScreen( new BackgroundScreen(), null ); screenManager.AddScreen( new MainMenuScreen(), null ); LoadingScreen.Load( screenManager, true, PlayerIndex.One, new GameplayScreen() ); // Debugging components DebugManager = new DebugManager( this ); Components.Add( DebugManager ); CommandLine = new DebugCommandUI( this ); CommandLine.DrawOrder = 100; Components.Add( CommandLine ); FpsCounter = new FpsCounter( this ); Components.Add( FpsCounter ); TimeRuler = new TimeRuler( this ); Components.Add( TimeRuler ); }
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> /// コンポーネントの初期化 /// </summary> public override void Initialize() { debugManager = Game.Services.GetService(typeof(DebugManager)) as DebugManager; if (debugManager == null) throw new InvalidOperationException("DebugManagerが見つかりません。"); base.Initialize(); }
public override void Initialize() { #if TRACE debugManager = Game.Services.GetService(typeof(DebugManager)) as DebugManager; if (debugManager == null) throw new InvalidOperationException("DebugManagerが登録されていません"); // DebugCommandHostが登録されているのなら、コマンドを登録 IDebugCommandHost host = Game.Services.GetService(typeof(IDebugCommandHost)) as IDebugCommandHost; if (host != null) { host.RegisterCommand("tr", "TimeRuler", this.CommandExecute); this.Visible = false; this.Enabled = false; } // パラメーターの初期化 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(); }
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(); }