mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
sf::Joystick now handles controllers designated as "Gamepad" (Fix #138)
This commit is contained in:
parent
537e8c9e8d
commit
167618a89e
@ -75,10 +75,23 @@ HIDJoystickManager::HIDJoystickManager()
|
||||
{
|
||||
myHIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
|
||||
CFDictionaryRef mask = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop,
|
||||
CFDictionaryRef mask0 = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop,
|
||||
kHIDUsage_GD_Joystick);
|
||||
IOHIDManagerSetDeviceMatching(myHIDManager, mask);
|
||||
|
||||
CFDictionaryRef mask1 = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop,
|
||||
kHIDUsage_GD_GamePad);
|
||||
|
||||
CFDictionaryRef maskArray[2];
|
||||
maskArray[0] = mask0;
|
||||
maskArray[1] = mask1;
|
||||
|
||||
CFArrayRef mask = CFArrayCreate(NULL, (const void**)maskArray, 2, NULL);
|
||||
|
||||
IOHIDManagerSetDeviceMatchingMultiple(myHIDManager, mask);
|
||||
CFRelease(mask);
|
||||
CFRelease(mask1);
|
||||
CFRelease(mask0);
|
||||
|
||||
|
||||
IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, pluggedIn, this);
|
||||
IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, pluggedOut, this);
|
||||
|
Loading…
Reference in New Issue
Block a user