aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Input/IGamepadDriver.cs
blob: 625c3e69413285d1d81045ec6bf55c1edf008888 (plain) (blame)
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
using System;

namespace Ryujinx.Input
{
    /// <summary>
    /// Represent an emulated gamepad driver used to provide input in the emulator.
    /// </summary>
    public interface IGamepadDriver : IDisposable
    {
        /// <summary>
        /// The name of the driver
        /// </summary>
        string DriverName { get; }

        /// <summary>
        /// The unique ids of the gamepads connected.
        /// </summary>
        ReadOnlySpan<string> GamepadsIds { get; }

        /// <summary>
        /// Event triggered when a gamepad is connected.
        /// </summary>
        event Action<string> OnGamepadConnected;

        /// <summary>
        /// Event triggered when a gamepad is disconnected.
        /// </summary>
        event Action<string> OnGamepadDisconnected;

        /// <summary>
        /// Open a gampad by its unique id.
        /// </summary>
        /// <param name="id">The unique id of the gamepad</param>
        /// <returns>An instance of <see cref="IGamepad"/> associated to the gamepad id given or null if not found</returns>
        IGamepad GetGamepad(string id);

        /// <summary>
        /// Clear the internal state of the driver.
        /// </summary>
        /// <remarks>Does nothing by default.</remarks>
        void Clear() { }
    }
}