summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ModInputEvents.cs
blob: feca34f353968e19614f311953bdbc17284948cf (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<InputButtonPressedEventArgs> ButtonPressed
        {
            add => this.EventManager.Input_ButtonPressed.Add(value);
            remove => this.EventManager.Input_ButtonPressed.Remove(value);
        }

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

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

        /// <summary>Raised after the player scrolls the mouse wheel.</summary>
        public event EventHandler<InputMouseWheelScrolledEventArgs> MouseWheelScrolled
        {
            add => this.EventManager.Input_MouseWheelScrolled.Add(value);
            remove => this.EventManager.Input_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) { }
    }
}