[Win] WinRawInput is IKeyboard/MouseDriver2
Since we do not use Raw Input for joystick devices, it does not make sense to expose the IJoystickDriver2 interface through WinRawInput. This keeps allows joystick and keyboard/mouse implementations to reside in distinct, modular classes, instantiated separately through WinFactory.
This commit is contained in:
parent
8968f7ff38
commit
765ad9e05b
2 changed files with 3 additions and 32 deletions
|
@ -33,7 +33,7 @@ using OpenTK.Input;
|
||||||
|
|
||||||
namespace OpenTK.Platform.Windows
|
namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
abstract class WinInputBase : IInputDriver2
|
abstract class WinInputBase
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
|
@ -158,13 +158,11 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IInputDriver2 Members
|
#region Public Members
|
||||||
|
|
||||||
public abstract IMouseDriver2 MouseDriver { get; }
|
public abstract IMouseDriver2 MouseDriver { get; }
|
||||||
public abstract IKeyboardDriver2 KeyboardDriver { get; }
|
|
||||||
public abstract IGamePadDriver GamePadDriver { get; }
|
|
||||||
|
|
||||||
public abstract IJoystickDriver2 JoystickDriver { get; }
|
public abstract IKeyboardDriver2 KeyboardDriver { get; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,6 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
WinRawKeyboard keyboard_driver;
|
WinRawKeyboard keyboard_driver;
|
||||||
WinRawMouse mouse_driver;
|
WinRawMouse mouse_driver;
|
||||||
IGamePadDriver gamepad_driver;
|
|
||||||
IJoystickDriver2 joystick_driver;
|
|
||||||
|
|
||||||
IntPtr DevNotifyHandle;
|
IntPtr DevNotifyHandle;
|
||||||
static readonly Guid DeviceInterfaceHid = new Guid("4D1E55B2-F16F-11CF-88CB-001111000030");
|
static readonly Guid DeviceInterfaceHid = new Guid("4D1E55B2-F16F-11CF-88CB-001111000030");
|
||||||
|
@ -138,17 +136,6 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
keyboard_driver = new WinRawKeyboard(Parent.Handle);
|
keyboard_driver = new WinRawKeyboard(Parent.Handle);
|
||||||
mouse_driver = new WinRawMouse(Parent.Handle);
|
mouse_driver = new WinRawMouse(Parent.Handle);
|
||||||
joystick_driver = new WinMMJoystick();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
gamepad_driver = new XInputJoystick();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Debug.Print("[Win] XInput driver not supported, falling back to WinMM");
|
|
||||||
gamepad_driver = new MappedGamePadDriver();
|
|
||||||
}
|
|
||||||
|
|
||||||
DevNotifyHandle = RegisterForDeviceNotifications(Parent);
|
DevNotifyHandle = RegisterForDeviceNotifications(Parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,10 +168,6 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IInputDriver2 Members
|
|
||||||
|
|
||||||
public override IKeyboardDriver2 KeyboardDriver
|
public override IKeyboardDriver2 KeyboardDriver
|
||||||
{
|
{
|
||||||
get { return keyboard_driver; }
|
get { return keyboard_driver; }
|
||||||
|
@ -195,16 +178,6 @@ namespace OpenTK.Platform.Windows
|
||||||
get { return mouse_driver; }
|
get { return mouse_driver; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IGamePadDriver GamePadDriver
|
|
||||||
{
|
|
||||||
get { return gamepad_driver; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IJoystickDriver2 JoystickDriver
|
|
||||||
{
|
|
||||||
get { return joystick_driver; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue