/ src / Ryujinx.Input.SDL2 / SDLKeyboardDriver.cs
SDLKeyboardDriver.cs
 1  using Ryujinx.SDL2.Common;
 2  using System;
 3  
 4  namespace Ryujinx.Input.SDL2
 5  {
 6      public class SDL2KeyboardDriver : IGamepadDriver
 7      {
 8          public SDL2KeyboardDriver()
 9          {
10              SDL2Driver.Instance.Initialize();
11          }
12  
13          public string DriverName => "SDL2";
14  
15          private static readonly string[] _keyboardIdentifers = new string[1] { "0" };
16  
17          public ReadOnlySpan<string> GamepadsIds => _keyboardIdentifers;
18  
19          public event Action<string> OnGamepadConnected
20          {
21              add { }
22              remove { }
23          }
24  
25          public event Action<string> OnGamepadDisconnected
26          {
27              add { }
28              remove { }
29          }
30  
31          protected virtual void Dispose(bool disposing)
32          {
33              if (disposing)
34              {
35                  SDL2Driver.Instance.Dispose();
36              }
37          }
38  
39          public void Dispose()
40          {
41              GC.SuppressFinalize(this);
42              Dispose(true);
43          }
44  
45          public IGamepad GetGamepad(string id)
46          {
47              if (!_keyboardIdentifers[0].Equals(id))
48              {
49                  return null;
50              }
51  
52              return new SDL2Keyboard(this, _keyboardIdentifers[0], "All keyboards");
53          }
54      }
55  }