From cee712105850ac3385cd0091a923438167433f9f Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:22:00 +0200 Subject: Move solution and projects to src --- src/Ryujinx.Input.SDL2/SDLKeyboardDriver.cs | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/Ryujinx.Input.SDL2/SDLKeyboardDriver.cs (limited to 'src/Ryujinx.Input.SDL2/SDLKeyboardDriver.cs') diff --git a/src/Ryujinx.Input.SDL2/SDLKeyboardDriver.cs b/src/Ryujinx.Input.SDL2/SDLKeyboardDriver.cs new file mode 100644 index 00000000..e9361c24 --- /dev/null +++ b/src/Ryujinx.Input.SDL2/SDLKeyboardDriver.cs @@ -0,0 +1,54 @@ +using Ryujinx.SDL2.Common; +using System; + +namespace Ryujinx.Input.SDL2 +{ + public class SDL2KeyboardDriver : IGamepadDriver + { + public SDL2KeyboardDriver() + { + SDL2Driver.Instance.Initialize(); + } + + public string DriverName => "SDL2"; + + private static readonly string[] _keyboardIdentifers = new string[1] { "0" }; + + public ReadOnlySpan GamepadsIds => _keyboardIdentifers; + + public event Action OnGamepadConnected + { + add { } + remove { } + } + + public event Action OnGamepadDisconnected + { + add { } + remove { } + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + SDL2Driver.Instance.Dispose(); + } + } + + public void Dispose() + { + Dispose(true); + } + + public IGamepad GetGamepad(string id) + { + if (!_keyboardIdentifers[0].Equals(id)) + { + return null; + } + + return new SDL2Keyboard(this, _keyboardIdentifers[0], "All keyboards"); + } + } +} \ No newline at end of file -- cgit v1.2.3