コード例 #1
0
ファイル: Game1.cs プロジェクト: himapo/ccm
        /// <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();
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: yxrkt/outbreak
        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 );
        }