浏览代码

Added MouseDelta To MouseCondition.cs (#11)

* Added MouseDelta field

* Update MouseCondition.cs
Moonstone 4 年之前
父节点
当前提交
9ee935c03c
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Source/MouseCondition.cs

+ 5 - 1
Source/MouseCondition.cs

@@ -1,4 +1,5 @@
-using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
 
 
 namespace Apos.Input {
 namespace Apos.Input {
     /// <summary>
     /// <summary>
@@ -61,6 +62,9 @@ namespace Apos.Input {
                 0 <= InputHelper.NewMouse.X && InputHelper.NewMouse.X <= InputHelper.WindowWidth &&
                 0 <= InputHelper.NewMouse.X && InputHelper.NewMouse.X <= InputHelper.WindowWidth &&
                 0 <= InputHelper.NewMouse.Y && InputHelper.NewMouse.Y <= InputHelper.WindowHeight;
                 0 <= InputHelper.NewMouse.Y && InputHelper.NewMouse.Y <= InputHelper.WindowHeight;
 
 
+        ///<returns>Returns the difference between the last frame and this frame's mouse position</returns>
+        public static Point MouseDelta => InputHelper.NewMouse.Position - InputHelper.OldMouse.Position;
+
         /// <summary>
         /// <summary>
         /// The button that will be checked.
         /// The button that will be checked.
         /// </summary>
         /// </summary>