SampleGame.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. using Microsoft.Xna.Framework.Input;
  5. namespace Samples.Animation
  6. {
  7. public class SampleGame : Game
  8. {
  9. GraphicsDeviceManager graphics;
  10. AnimationSampleComponent _animationSampleComponent;
  11. public SampleGame()
  12. {
  13. graphics = new GraphicsDeviceManager(this);
  14. Content.RootDirectory = "Content";
  15. _animationSampleComponent = new AnimationSampleComponent(this);
  16. Components.Add(_animationSampleComponent);
  17. }
  18. protected override void Initialize()
  19. {
  20. base.Initialize();
  21. }
  22. protected override void LoadContent()
  23. {
  24. }
  25. protected override void UnloadContent()
  26. {
  27. }
  28. protected override void Update(GameTime gameTime)
  29. {
  30. var keyboardState = Keyboard.GetState();
  31. var gamePadState = GamePad.GetState(PlayerIndex.One);
  32. // Allows the game to exit
  33. if (keyboardState.IsKeyDown(Keys.Escape) || gamePadState.Buttons.Back == ButtonState.Pressed)
  34. this.Exit();
  35. base.Update(gameTime);
  36. }
  37. protected override void Draw(GameTime gameTime)
  38. {
  39. GraphicsDevice.SetRenderTarget(null);
  40. GraphicsDevice.Clear(Color.Black);
  41. base.Draw(gameTime);
  42. }
  43. }
  44. }