XInputHelper.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // XInputHelper.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 Microsoft.Xna.Framework;
  11. using Microsoft.Xna.Framework.Input;
  12. #endregion
  13. namespace Spacewar
  14. {
  15. /// <summary>
  16. /// Provides a wrapper around the gamepads to allow single button presses to be detected
  17. /// </summary>
  18. public static class XInputHelper
  19. {
  20. /// <summary>
  21. /// Current pressed state of the gamepads
  22. /// </summary>
  23. private static GamePads gamePads = new GamePads();
  24. #region Properties
  25. public static GamePads GamePads
  26. {
  27. get
  28. {
  29. return gamePads;
  30. }
  31. }
  32. #endregion
  33. /// <summary>
  34. /// Update the state so presses can be detected - this should be called once per frame
  35. /// </summary>
  36. public static void Update(Game game, KeyboardState keyState)
  37. {
  38. gamePads.Update(game, keyState);
  39. }
  40. }
  41. }