AnimationGame.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 AnimationGame : Game
  8. {
  9. GraphicsDeviceManager graphics;
  10. AnimationSampleComponent _animationSampleComponent;
  11. public AnimationGame()
  12. {
  13. graphics = new GraphicsDeviceManager(this);
  14. Content.RootDirectory = "Content";
  15. _animationSampleComponent = new AnimationSampleComponent(this);
  16. Components.Add(_animationSampleComponent);
  17. graphics.GraphicsProfile = GraphicsProfile.HiDef;
  18. }
  19. protected override void Initialize()
  20. {
  21. base.Initialize();
  22. }
  23. protected override void LoadContent()
  24. {
  25. }
  26. protected override void UnloadContent()
  27. {
  28. }
  29. protected override void Update(GameTime gameTime)
  30. {
  31. var keyboardState = Keyboard.GetState();
  32. var gamePadState = GamePad.GetState(PlayerIndex.One);
  33. // Allows the game to exit
  34. if (keyboardState.IsKeyDown(Keys.Escape) || gamePadState.Buttons.Back == ButtonState.Pressed)
  35. this.Exit();
  36. base.Update(gameTime);
  37. }
  38. protected override void Draw(GameTime gameTime)
  39. {
  40. GraphicsDevice.SetRenderTarget(null);
  41. GraphicsDevice.Clear(Color.Black);
  42. base.Draw(gameTime);
  43. }
  44. }
  45. }