InputHelper.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // InputHelper.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using Microsoft.Xna.Framework;
  12. #endregion
  13. namespace Marblets
  14. {
  15. /// <summary>
  16. /// Provides a wrapper around the gamepads to allow single button presses to be
  17. /// detected also provides keyboard aliasing to allow keyboards to be used to play
  18. /// </summary>
  19. public class InputHelper : GameComponent
  20. {
  21. /// <summary>
  22. /// Current pressed state of the gamepads
  23. /// </summary>
  24. static public GamePads GamePads = new GamePads();
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="InputHelper"/> class.
  27. /// </summary>
  28. /// <param name="game">Game the game component should be attached to.</param>
  29. public InputHelper(Game game)
  30. : base(game)
  31. {
  32. }
  33. /// <summary>
  34. /// Called when the GameComponent needs to be updated. This polls all the game
  35. /// pads and updates the state
  36. /// </summary>
  37. /// <param name="gameTime">Current game time</param>
  38. public override void Update(GameTime gameTime)
  39. {
  40. base.Update(gameTime);
  41. GamePads.Update(this.Game);
  42. }
  43. }
  44. }