DeferredGame.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. using Microsoft.Xna.Framework.Input;
  5. namespace Samples.Deferred
  6. {
  7. public class DeferredGame : Game
  8. {
  9. GraphicsDeviceManager graphics;
  10. DeferredSampleComponent _deferredSampleComponent;
  11. public DeferredGame()
  12. {
  13. graphics = new GraphicsDeviceManager(this);
  14. Content.RootDirectory = "Content";
  15. graphics.GraphicsProfile = GraphicsProfile.HiDef;
  16. _deferredSampleComponent = new DeferredSampleComponent(this);
  17. Components.Add(_deferredSampleComponent);
  18. }
  19. protected override void LoadContent()
  20. {
  21. }
  22. /// <param name="gameTime">Provides a snapshot of timing values.</param>
  23. protected override void Update(GameTime gameTime)
  24. {
  25. KeyboardState keyState = Keyboard.GetState();
  26. GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
  27. if (keyState.IsKeyDown(Keys.Escape) || gamePadState.Buttons.Back == ButtonState.Pressed)
  28. Exit();
  29. base.Update(gameTime);
  30. }
  31. protected override void Draw(GameTime gameTime)
  32. {
  33. GraphicsDevice.SetRenderTarget(null);
  34. GraphicsDevice.Clear(Color.Black);
  35. base.Draw(gameTime);
  36. }
  37. }
  38. }