Ejemplo n.º 1
0
        public static FrameRate CreateFrameRate(Game game)
        {
            FrameRate frameRate = new FrameRate(game);
              frameRate.UpdateOrder = 1;
              game.Components.Add(frameRate);

              return frameRate;
        }
Ejemplo n.º 2
0
//#if perfhud
//    private void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) 
//    { 
//      foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters) 
//      { 
//        if (adapter.Description.Contains("PerfHUD")) 
//        { 
//          e.GraphicsDeviceInformation.Adapter = adapter; 
//          //e.GraphicsDeviceInformation.DeviceType = DeviceType.Reference; 
//          break; 
//        } 
//      } 

//      return; 
//    }
//#endif


    protected override void Initialize()
    {
      // main camera
      mainCamera = cameraManager.CreateCamera("Main");
      mainCamera.fViewport = GraphicsDevice.Viewport;
      mainCamera.fLocalPosition = new Position3(0, 0, 10000);
      mainCamera.AcceptInput = true;


      // frustum camera
      if (Constants.UseFrustumCamera)
      {
        frustumCamera = cameraManager.CreateCamera("Frustum");
        frustumCamera.fViewport = GraphicsDevice.Viewport;
        frustumCamera.fLocalPosition = new Position3(0, 0, 10000);
        frustumCamera.AcceptInput = false;

        //cameraManager.ActivateFrustumCamera("Frustum");
      }

      // sun camera
      sunCamera = cameraManager.CreateCamera("SunCam");
      sunCamera.fViewport = new Viewport();
      sunCamera.fViewport.Width = 32;
      sunCamera.fViewport.Height = 32;


      // frame rate calculation
      frameRate = new FrameRate(this);
      frameRate.UpdateOrder = 1;
      Components.Add(frameRate);


      Mouse.SetPosition(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2);

      base.Initialize();

      ResetCameraPosition();
    }