summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-06-02 12:14:15 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-06-02 12:14:15 -0400
commit90f55a6921ac798e03d6f81240d3a9899544c031 (patch)
treed19e551679c69d436028e30115740242d8a90104 /src/SMAPI/Events
parent74971f532822b44fbffc99810afd2c0d8a0d424d (diff)
downloadSMAPI-90f55a6921ac798e03d6f81240d3a9899544c031.tar.gz
SMAPI-90f55a6921ac798e03d6f81240d3a9899544c031.tar.bz2
SMAPI-90f55a6921ac798e03d6f81240d3a9899544c031.zip
add mouse scroll event (#310)
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/IInputEvents.cs3
-rw-r--r--src/SMAPI/Events/InputMouseWheelScrolledEventArgs.cs38
2 files changed, 41 insertions, 0 deletions
diff --git a/src/SMAPI/Events/IInputEvents.cs b/src/SMAPI/Events/IInputEvents.cs
index 938c772b..64d82c57 100644
--- a/src/SMAPI/Events/IInputEvents.cs
+++ b/src/SMAPI/Events/IInputEvents.cs
@@ -13,5 +13,8 @@ namespace StardewModdingAPI.Events
/// <summary>Raised after the player moves the in-game cursor.</summary>
event EventHandler<InputCursorMovedArgsInput> CursorMoved;
+
+ /// <summary>Raised after the player scrolls the mouse wheel.</summary>
+ event EventHandler<InputMouseWheelScrolledEventArgs> MouseWheelScrolled;
}
}
diff --git a/src/SMAPI/Events/InputMouseWheelScrolledEventArgs.cs b/src/SMAPI/Events/InputMouseWheelScrolledEventArgs.cs
new file mode 100644
index 00000000..9afab9cc
--- /dev/null
+++ b/src/SMAPI/Events/InputMouseWheelScrolledEventArgs.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments when the player scrolls the mouse wheel.</summary>
+ public class InputMouseWheelScrolledEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The cursor position.</summary>
+ public ICursorPosition Position { get; }
+
+ /// <summary>The old scroll value.</summary>
+ public int OldValue { get; }
+
+ /// <summary>The new scroll value.</summary>
+ public int NewValue { get; }
+
+ /// <summary>The amount by which the scroll value changed.</summary>
+ public int Delta => this.NewValue - this.OldValue;
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="position">The cursor position.</param>
+ /// <param name="oldValue">The old scroll value.</param>
+ /// <param name="newValue">The new scroll value.</param>
+ public InputMouseWheelScrolledEventArgs(ICursorPosition position, int oldValue, int newValue)
+ {
+ this.Position = position;
+ this.OldValue = oldValue;
+ this.NewValue = newValue;
+ }
+ }
+}