Implement generic Consumer device which returns a button collection

This commit is contained in:
Christopher Lees 2017-07-27 16:39:37 +01:00
parent 7680969ae1
commit bef43af969
3 changed files with 11 additions and 1 deletions

View file

@ -141,7 +141,8 @@ namespace OpenTK.Platform.Common
// Consumer electronic devices
internal enum HIDUsageCD
{
ACPan = 0x0238
ACPan = 0x0238,
ConsumerControl = 0x01
}
// Generic desktop usage

View file

@ -2126,6 +2126,14 @@ namespace OpenTK.Platform.Windows
Target = target;
}
public RawInputDevice(HIDUsageCD usage, RawInputDeviceFlags flags, HWND target)
{
UsagePage = HIDPage.Consumer;
Usage = (short)usage;
Flags = flags;
Target = target;
}
public RawInputDevice(HIDUsageSim usage, RawInputDeviceFlags flags, HWND target)
{
UsagePage = HIDPage.Simulation;

View file

@ -194,6 +194,7 @@ namespace OpenTK.Platform.Windows
{
new RawInputDevice(HIDUsageGD.Joystick, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
new RawInputDevice(HIDUsageGD.GamePad, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
new RawInputDevice(HIDUsageCD.ConsumerControl, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
};
if (!Functions.RegisterRawInputDevices(DeviceTypes, DeviceTypes.Length, API.RawInputDeviceSize))