summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ModInputEvents.cs
blob: ab26ab3e75d12cadc0944e1571b3f34c91ee8989 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using StardewModdingAPI.Events;

namespace StardewModdingAPI.Framework.Events
{
    /// <summary>Events raised when the player provides input using a controller, keyboard, or mouse.</summary>
    internal class ModInputEvents : ModEventsBase, IInputEvents
    {
        /*********
        ** Accessors
        *********/
        /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
        public event EventHandler<ButtonPressedEventArgs> ButtonPressed
        {
            add => this.EventManager.ButtonPressed.Add(value, this.Mod);
            remove => this.EventManager.ButtonPressed.Remove(value);
        }

        /// <summary>Raised after the player releases a button on the keyboard, controller, or mouse.</summary>
        public event EventHandler<ButtonReleasedEventArgs> ButtonReleased
        {
            add => this.EventManager.ButtonReleased.Add(value, this.Mod);
            remove => this.EventManager.ButtonReleased.Remove(value);
        }

        /// <summary>Raised after the player moves the in-game cursor.</summary>
        public event EventHandler<CursorMovedEventArgs> CursorMoved
        {
            add => this.EventManager.CursorMoved.Add(value, this.Mod);
            remove => this.EventManager.CursorMoved.Remove(value);
        }

        /// <summary>Raised after the player scrolls the mouse wheel.</summary>
        public event EventHandler<MouseWheelScrolledEventArgs> MouseWheelScrolled
        {
            add => this.EventManager.MouseWheelScrolled.Add(value, this.Mod);
            remove => this.EventManager.MouseWheelScrolled.Remove(value);
        }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="mod">The mod which uses this instance.</param>
        /// <param name="eventManager">The underlying event manager.</param>
        internal ModInputEvents(IModMetadata mod, EventManager eventManager)
            : base(mod, eventManager) { }
    }
}