1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-14 05:36:40 +00:00
Ryujinx/Ryujinx.Input/HLE/InputManager.cs
emmauss 77aab9aca3
Add Direct Mouse Support (#2374)
* and direct mouse support

* and direct mouse support

* hide cursor if mouse enabled

* add config

* update docs

* sorted usings
2021-06-24 02:09:08 +02:00

54 lines
1.4 KiB
C#

using System;
namespace Ryujinx.Input.HLE
{
public class InputManager : IDisposable
{
public IGamepadDriver KeyboardDriver { get; private set; }
public IGamepadDriver GamepadDriver { get; private set; }
public IGamepadDriver MouseDriver { get; private set; }
public InputManager(IGamepadDriver keyboardDriver, IGamepadDriver gamepadDriver)
{
KeyboardDriver = keyboardDriver;
GamepadDriver = gamepadDriver;
}
public void SetMouseDriver(IGamepadDriver mouseDriver)
{
MouseDriver?.Dispose();
MouseDriver = mouseDriver;
}
public NpadManager CreateNpadManager()
{
return new NpadManager(KeyboardDriver, GamepadDriver, MouseDriver);
}
public TouchScreenManager CreateTouchScreenManager()
{
if (MouseDriver == null)
{
throw new InvalidOperationException("Mouse Driver has not been initialized.");
}
return new TouchScreenManager(MouseDriver.GetGamepad("0") as IMouse);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
KeyboardDriver?.Dispose();
GamepadDriver?.Dispose();
MouseDriver?.Dispose();
}
}
public void Dispose()
{
Dispose(true);
}
}
}