2023-12-04 13:17:13 +00:00
|
|
|
using Ryujinx.SDL2.Common;
|
2021-05-21 00:16:34 +01:00
|
|
|
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<string> GamepadsIds => _keyboardIdentifers;
|
|
|
|
|
|
|
|
public event Action<string> OnGamepadConnected
|
|
|
|
{
|
|
|
|
add { }
|
|
|
|
remove { }
|
|
|
|
}
|
|
|
|
|
|
|
|
public event Action<string> OnGamepadDisconnected
|
|
|
|
{
|
|
|
|
add { }
|
|
|
|
remove { }
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void Dispose(bool disposing)
|
|
|
|
{
|
|
|
|
if (disposing)
|
|
|
|
{
|
|
|
|
SDL2Driver.Instance.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
2023-06-26 02:55:25 +01:00
|
|
|
GC.SuppressFinalize(this);
|
2021-05-21 00:16:34 +01:00
|
|
|
Dispose(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public IGamepad GetGamepad(string id)
|
|
|
|
{
|
|
|
|
if (!_keyboardIdentifers[0].Equals(id))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new SDL2Keyboard(this, _keyboardIdentifers[0], "All keyboards");
|
|
|
|
}
|
|
|
|
}
|
2023-06-26 02:55:25 +01:00
|
|
|
}
|