summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Events
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/Events
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/Events')
-rw-r--r--src/StardewModdingAPI/Events/ControlEvents.cs6
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs18
2 files changed, 19 insertions, 5 deletions
diff --git a/src/StardewModdingAPI/Events/ControlEvents.cs b/src/StardewModdingAPI/Events/ControlEvents.cs
index 8fb9061d..1b1e0b78 100644
--- a/src/StardewModdingAPI/Events/ControlEvents.cs
+++ b/src/StardewModdingAPI/Events/ControlEvents.cs
@@ -49,9 +49,11 @@ namespace StardewModdingAPI.Events
/// <summary>Raise a <see cref="MouseChanged"/> event.</summary>
/// <param name="priorState">The previous mouse state.</param>
/// <param name="newState">The current mouse state.</param>
- internal static void InvokeMouseChanged(MouseState priorState, MouseState newState)
+ /// <param name="priorPosition">The previous mouse position on the screen adjusted for the zoom level.</param>
+ /// <param name="newPosition">The current mouse position on the screen adjusted for the zoom level.</param>
+ internal static void InvokeMouseChanged(MouseState priorState, MouseState newState, Point priorPosition, Point newPosition)
{
- ControlEvents.MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
+ ControlEvents.MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState, priorPosition, newPosition));
}
/// <summary>Raise a <see cref="KeyPressed"/> event.</summary>
diff --git a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
index 9117a0c2..0997ad18 100644
--- a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
@@ -1,5 +1,7 @@
using System;
+using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
+using StardewValley;
namespace StardewModdingAPI.Events
{
@@ -10,10 +12,16 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous mouse state.</summary>
- public MouseState NewState { get; private set; }
+ public MouseState PriorState { get; private set; }
/// <summary>The current mouse state.</summary>
- public MouseState PriorState { get; private set; }
+ public MouseState NewState { get; private set; }
+
+ /// <summary>The previous mouse position on the screen adjusted for the zoom level.</summary>
+ public Point PriorPosition { get; private set; }
+
+ /// <summary>The current mouse position on the screen adjusted for the zoom level.</summary>
+ public Point NewPosition { get; private set; }
/*********
@@ -22,10 +30,14 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="priorState">The previous mouse state.</param>
/// <param name="newState">The current mouse state.</param>
- public EventArgsMouseStateChanged(MouseState priorState, MouseState newState)
+ /// <param name="priorPosition">The previous mouse position on the screen adjusted for the zoom level.</param>
+ /// <param name="newPosition">The current mouse position on the screen adjusted for the zoom level.</param>
+ public EventArgsMouseStateChanged(MouseState priorState, MouseState newState, Point priorPosition, Point newPosition)
{
this.PriorState = priorState;
this.NewState = newState;
+ this.PriorPosition = priorPosition;
+ this.NewPosition = newPosition;
}
}
}