summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Inheritance
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 17:01:16 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 17:01:16 -0400
commit7d0cd22f1ec0465c666cf0c69cbfa4da5fd3fe1a (patch)
treeb691561c5714335f41a815f6c51c09449ff6c665 /src/StardewModdingAPI/Inheritance
parent652776ed022f558321ce7e16407c31c6f4c057a5 (diff)
downloadSMAPI-7d0cd22f1ec0465c666cf0c69cbfa4da5fd3fe1a.tar.gz
SMAPI-7d0cd22f1ec0465c666cf0c69cbfa4da5fd3fe1a.tar.bz2
SMAPI-7d0cd22f1ec0465c666cf0c69cbfa4da5fd3fe1a.zip
add zoom-adjusted mouse position to mouse-changed event arguments (#129)
Diffstat (limited to 'src/StardewModdingAPI/Inheritance')
-rw-r--r--src/StardewModdingAPI/Inheritance/SGame.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs
index c595fae3..b0e6bebc 100644
--- a/src/StardewModdingAPI/Inheritance/SGame.cs
+++ b/src/StardewModdingAPI/Inheritance/SGame.cs
@@ -54,6 +54,12 @@ namespace StardewModdingAPI.Inheritance
/// </summary>
public MouseState MStatePrior { get; private set; }
+ /// <summary>The current mouse position on the screen adjusted for the zoom level.</summary>
+ public Point MPositionNow { get; private set; }
+
+ /// <summary>The previous mouse position on the screen adjusted for the zoom level.</summary>
+ public Point MPositionPrior { get; private set; }
+
/// <summary>
/// All keys pressed on the current frame
/// </summary>
@@ -261,7 +267,7 @@ namespace StardewModdingAPI.Inheritance
{
return WasButtonJustPressed(button, value > 0.2f ? ButtonState.Pressed : ButtonState.Released, stateIndex);
}
-
+
/// <summary>
/// Whether or not an analog button was just released on the controller
/// </summary>
@@ -767,7 +773,7 @@ namespace StardewModdingAPI.Inheritance
//typeof (Game).GetMethod("Update", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(this, new object[] {gameTime});
//base.Update(gameTime);
-
+
#endregion
}
else
@@ -1403,6 +1409,7 @@ namespace StardewModdingAPI.Inheritance
KStateNow = Keyboard.GetState();
MStateNow = Mouse.GetState();
+ MPositionNow = new Point(Game1.getMouseX(), Game1.getMouseY());
foreach (var k in FramePressedKeys)
ControlEvents.InvokeKeyPressed(k);
@@ -1449,8 +1456,9 @@ namespace StardewModdingAPI.Inheritance
if (MStateNow != MStatePrior)
{
- ControlEvents.InvokeMouseChanged(MStatePrior, MStateNow);
+ ControlEvents.InvokeMouseChanged(MStatePrior, MStateNow, MPositionPrior, MPositionNow);
MStatePrior = MStateNow;
+ MPositionPrior = MPositionPrior;
}
if (activeClickableMenu != null && activeClickableMenu != PreviousActiveMenu)