Merge pull request #1079 from lioncash/lol-objc
InputCommon: Initialize NSDictionaries using literal syntax.
This commit is contained in:
commit
0b44795cf3
|
@ -22,13 +22,10 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index)
|
||||||
, m_ff_device(nullptr)
|
, m_ff_device(nullptr)
|
||||||
{
|
{
|
||||||
// Buttons
|
// Buttons
|
||||||
NSDictionary *buttonDict =
|
NSDictionary *buttonDict = @{
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
@kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
||||||
[NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
@kIOHIDElementUsagePageKey : [NSNumber numberWithInteger: kHIDPage_Button]
|
||||||
@kIOHIDElementTypeKey,
|
};
|
||||||
[NSNumber numberWithInteger: kHIDPage_Button],
|
|
||||||
@kIOHIDElementUsagePageKey,
|
|
||||||
nil];
|
|
||||||
|
|
||||||
CFArrayRef buttons = IOHIDDeviceCopyMatchingElements(m_device,
|
CFArrayRef buttons = IOHIDDeviceCopyMatchingElements(m_device,
|
||||||
(CFDictionaryRef)buttonDict, kIOHIDOptionsTypeNone);
|
(CFDictionaryRef)buttonDict, kIOHIDOptionsTypeNone);
|
||||||
|
@ -47,11 +44,9 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Axes
|
// Axes
|
||||||
NSDictionary *axisDict =
|
NSDictionary *axisDict = @{
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
@kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Misc]
|
||||||
[NSNumber numberWithInteger: kIOHIDElementTypeInput_Misc],
|
};
|
||||||
@kIOHIDElementTypeKey,
|
|
||||||
nil];
|
|
||||||
|
|
||||||
CFArrayRef axes = IOHIDDeviceCopyMatchingElements(m_device,
|
CFArrayRef axes = IOHIDDeviceCopyMatchingElements(m_device,
|
||||||
(CFDictionaryRef)axisDict, kIOHIDOptionsTypeNone);
|
(CFDictionaryRef)axisDict, kIOHIDOptionsTypeNone);
|
||||||
|
|
|
@ -23,13 +23,11 @@ Keyboard::Keyboard(IOHIDDeviceRef device, std::string name, int index, void *win
|
||||||
{
|
{
|
||||||
// This class should only recieve Keyboard or Keypad devices
|
// This class should only recieve Keyboard or Keypad devices
|
||||||
// Now, filter on just the buttons we can handle sanely
|
// Now, filter on just the buttons we can handle sanely
|
||||||
NSDictionary *matchingElements =
|
NSDictionary *matchingElements = @{
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
@kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
||||||
[NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
@kIOHIDElementMinKey : [NSNumber numberWithInteger: 0],
|
||||||
@kIOHIDElementTypeKey,
|
@kIOHIDElementMaxKey : [NSNumber numberWithInteger: 1]
|
||||||
[NSNumber numberWithInteger: 0], @kIOHIDElementMinKey,
|
};
|
||||||
[NSNumber numberWithInteger: 1], @kIOHIDElementMaxKey,
|
|
||||||
nil];
|
|
||||||
|
|
||||||
CFArrayRef elements = IOHIDDeviceCopyMatchingElements(m_device,
|
CFArrayRef elements = IOHIDDeviceCopyMatchingElements(m_device,
|
||||||
(CFDictionaryRef)matchingElements, kIOHIDOptionsTypeNone);
|
(CFDictionaryRef)matchingElements, kIOHIDOptionsTypeNone);
|
||||||
|
|
Loading…
Reference in New Issue