SDLKeyboardDriver.cs 1.2 KB

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