/Engine/Game/MouseTracker.cs

# · C# · 54 lines · 35 code · 3 blank · 16 comment · 2 complexity · 23d0e64a9c6291b88fad69c1c8bf2d2c MD5 · raw file

  1. using Delta.Engine.Game.Interfaces;
  2. using Delta.InputSystem;
  3. using Delta.Utilities.Datatypes;
  4. namespace Delta.Engine.Game
  5. {
  6. /// <summary>
  7. /// Very simple class to provide an IAttachable interface that will always
  8. /// return the mouse position. Useful for effect testing.
  9. /// </summary>
  10. public class MouseTracker : IAttachable
  11. {
  12. #region Position (Public)
  13. /// <summary>
  14. /// The current position of the attachable.
  15. /// </summary>
  16. public Vector Position
  17. {
  18. get
  19. {
  20. return new Vector(Input.Mouse.Position, 0.0f);
  21. }
  22. }
  23. #endregion
  24. #region Rotation (Public)
  25. /// <summary>
  26. /// The current rotation of the attachable.
  27. /// </summary>
  28. public float Rotation
  29. {
  30. get
  31. {
  32. // Unused
  33. return 0.0f;
  34. }
  35. }
  36. #endregion
  37. #region Constructor
  38. /// <summary>
  39. /// Constructor for MouseTracker, just makes sure the input commands are
  40. /// initialized, which is useful for many tests.
  41. /// </summary>
  42. public MouseTracker()
  43. {
  44. if (Input.Commands == null)
  45. {
  46. // Dummy to initialize the commands
  47. }
  48. }
  49. #endregion
  50. }
  51. }