Connected XInput driver

This commit is contained in:
Stefanos A. 2013-12-24 14:24:42 +01:00
parent 062962aeb2
commit 42e6a96a43

View file

@ -43,7 +43,8 @@ namespace OpenTK.Platform.Windows
WinRawKeyboard keyboard_driver;
WinRawMouse mouse_driver;
WinMMJoystick joystick_driver;
IGamePadDriver gamepad_driver;
IJoystickDriver2 joystick_driver;
IntPtr DevNotifyHandle;
static readonly Guid DeviceInterfaceHid = new Guid("4D1E55B2-F16F-11CF-88CB-001111000030");
@ -138,6 +139,15 @@ namespace OpenTK.Platform.Windows
keyboard_driver = new WinRawKeyboard(Parent.Handle);
mouse_driver = new WinRawMouse(Parent.Handle);
joystick_driver = new WinMMJoystick();
try
{
gamepad_driver = new XInputJoystick();
}
catch (Exception e)
{
Debug.Print("[Win] XInput driver not supported, falling back to WinMM");
gamepad_driver = new MappedGamePadDriver();
}
DevNotifyHandle = RegisterForDeviceNotifications(Parent);
}
@ -187,12 +197,12 @@ namespace OpenTK.Platform.Windows
public override IGamePadDriver GamePadDriver
{
get { return joystick_driver; }
get { return gamepad_driver; }
}
public override IJoystickDriver2 JoystickDriver
{
get { throw new NotImplementedException(); }
get { return joystick_driver; }
}
#endregion