public override void Initialize() { debugManager = Game.Services.GetService( typeof( DebugManager ) ) as DebugManager; if ( debugManager == null ) throw new InvalidOperationException( "DebugManager is not registered." ); 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(); }
public override void Initialize() { #if TRACE debugManager = Game.Services.GetService( typeof( DebugManager ) ) as DebugManager; if ( debugManager == null ) throw new InvalidOperationException( "DebugManager is not 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; } logs = new FrameLog[2]; for ( int i = 0; i < logs.Length; ++i ) logs[i] = new FrameLog(); sampleFrames = TargetSampleFrames = 1; #endif base.Initialize(); }
public GameCore() { Content.RootDirectory = "Content"; graphics = new GraphicsDeviceManager( this ); PlayerWins = new Dictionary<uint, int>( 4 ); PlayerColors = new Color[4] { new Color( 10, 100, 220 ), new Color( 200, 31, 7 ), new Color( 240, 180, 0 ), new Color( 80, 200, 10 ), }; graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; IsFixedTimeStep = false; graphics.SynchronizeWithVerticalRetrace = true; AudioManager = new AudioManager( this ); Components.Add( AudioManager ); // Create the screen manager component. screenManager = new ScreenManager( this ); Components.Add( screenManager ); HighscoreComponent highscoreComponent = new HighscoreComponent( this, null, "Avatar Hamster Panic" ); HighscoreComponent.Global = highscoreComponent; Components.Add( highscoreComponent ); // Activate the first screens. //screenManager.AddScreen( new BackgroundScreen(), null ); //screenManager.AddScreen( new MainMenuScreen(), null ); DisplayGamertags = true; ShareHighScores = true; SoundEffectsVolume = 1f; MusicVolume = 1f; // Avatars require GamerServices Components.Add( new GamerServicesComponent( this ) ); Rumble = new RumbleComponent( this ); Components.Add( Rumble ); Instance = this; // Debugging components DebugManager = new DebugManager( this ); DebugManager.DrawOrder = 200; Components.Add( DebugManager ); DebugCommand = new DebugCommandUI( this ); DebugCommand.DrawOrder = 200; Components.Add( DebugCommand ); FpsCounter = new FpsCounter( this ); FpsCounter.DrawOrder = 200; Components.Add( FpsCounter ); TimeRuler = new TimeRuler( this ); TimeRuler.DrawOrder = 200; Components.Add( TimeRuler ); }
public override void Initialize() { debugManager = Game.Services.GetService( typeof( DebugManager ) ) as DebugManager; if ( debugManager == null ) throw new InvalidOperationException( "DebugManagerが見つかりません。" ); base.Initialize(); }