SDLKeyboardDriver.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. Dispose(true);
  34. }
  35. public IGamepad GetGamepad(string id)
  36. {
  37. if (!_keyboardIdentifers[0].Equals(id))
  38. {
  39. return null;
  40. }
  41. return new SDL2Keyboard(this, _keyboardIdentifers[0], "All keyboards");
  42. }
  43. }
  44. }