AtlasGame.cs 1.4 KB

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