diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-02 02:35:26 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-02 02:35:26 -0400 |
commit | 6f931aa576b2b2f6a64e7e0522e01f6a37c92c8a (patch) | |
tree | 403b30a28e19f5b4936ab85920a5678c562ff766 /src/SMAPI/Events | |
parent | 0df7a967a6980db7f4da8d393feae97c968e3375 (diff) | |
download | SMAPI-6f931aa576b2b2f6a64e7e0522e01f6a37c92c8a.tar.gz SMAPI-6f931aa576b2b2f6a64e7e0522e01f6a37c92c8a.tar.bz2 SMAPI-6f931aa576b2b2f6a64e7e0522e01f6a37c92c8a.zip |
add Input.CursorMoved event (#310)
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r-- | src/SMAPI/Events/ControlEvents.cs | 8 | ||||
-rw-r--r-- | src/SMAPI/Events/IInputEvents.cs | 7 | ||||
-rw-r--r-- | src/SMAPI/Events/InputCursorMovedEventArgs.cs | 30 |
3 files changed, 39 insertions, 6 deletions
diff --git a/src/SMAPI/Events/ControlEvents.cs b/src/SMAPI/Events/ControlEvents.cs index 77bbf3ab..a3994d1d 100644 --- a/src/SMAPI/Events/ControlEvents.cs +++ b/src/SMAPI/Events/ControlEvents.cs @@ -24,14 +24,14 @@ namespace StardewModdingAPI.Events remove => ControlEvents.EventManager.Legacy_Control_KeyboardChanged.Remove(value); } - /// <summary>Raised when the player presses a keyboard key.</summary> + /// <summary>Raised after the player presses a keyboard key.</summary> public static event EventHandler<EventArgsKeyPressed> KeyPressed { add => ControlEvents.EventManager.Legacy_Control_KeyPressed.Add(value); remove => ControlEvents.EventManager.Legacy_Control_KeyPressed.Remove(value); } - /// <summary>Raised when the player releases a keyboard key.</summary> + /// <summary>Raised after the player releases a keyboard key.</summary> public static event EventHandler<EventArgsKeyPressed> KeyReleased { add => ControlEvents.EventManager.Legacy_Control_KeyReleased.Add(value); @@ -41,8 +41,8 @@ namespace StardewModdingAPI.Events /// <summary>Raised when the <see cref="MouseState"/> changes. That happens when the player moves the mouse, scrolls the mouse wheel, or presses/releases a button.</summary> public static event EventHandler<EventArgsMouseStateChanged> MouseChanged { - add => ControlEvents.EventManager.Control_MouseChanged.Add(value); - remove => ControlEvents.EventManager.Control_MouseChanged.Remove(value); + add => ControlEvents.EventManager.Legacy_Control_MouseChanged.Add(value); + remove => ControlEvents.EventManager.Legacy_Control_MouseChanged.Remove(value); } /// <summary>The player pressed a controller button. This event isn't raised for trigger buttons.</summary> diff --git a/src/SMAPI/Events/IInputEvents.cs b/src/SMAPI/Events/IInputEvents.cs index 92802fda..938c772b 100644 --- a/src/SMAPI/Events/IInputEvents.cs +++ b/src/SMAPI/Events/IInputEvents.cs @@ -5,10 +5,13 @@ namespace StardewModdingAPI.Events /// <summary>Events raised when the player provides input using a controller, keyboard, or mouse.</summary> public interface IInputEvents { - /// <summary>Raised when the player presses a button on the keyboard, controller, or mouse.</summary> + /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary> event EventHandler<InputButtonPressedArgsInput> ButtonPressed; - /// <summary>Raised when the player releases a button on the keyboard, controller, or mouse.</summary> + /// <summary>Raised after the player releases a button on the keyboard, controller, or mouse.</summary> event EventHandler<InputButtonReleasedArgsInput> ButtonReleased; + + /// <summary>Raised after the player moves the in-game cursor.</summary> + event EventHandler<InputCursorMovedArgsInput> CursorMoved; } } diff --git a/src/SMAPI/Events/InputCursorMovedEventArgs.cs b/src/SMAPI/Events/InputCursorMovedEventArgs.cs new file mode 100644 index 00000000..02e1ee2c --- /dev/null +++ b/src/SMAPI/Events/InputCursorMovedEventArgs.cs @@ -0,0 +1,30 @@ +using System; + +namespace StardewModdingAPI.Events +{ + /// <summary>Event arguments when the in-game cursor is moved.</summary> + public class InputCursorMovedArgsInput : EventArgs + { + /********* + ** Accessors + *********/ + /// <summary>The previous cursor position.</summary> + public ICursorPosition OldPosition { get; } + + /// <summary>The current cursor position.</summary> + public ICursorPosition NewPosition { get; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="oldPosition">The previous cursor position.</param> + /// <param name="newPosition">The new cursor position.</param> + public InputCursorMovedArgsInput(ICursorPosition oldPosition, ICursorPosition newPosition) + { + this.OldPosition = oldPosition; + this.NewPosition = newPosition; + } + } +} |