InputCommon: Initialize NSDictionaries using literal syntax.
This commit is contained in:
parent
d7b7487405
commit
6cfc5b9849
|
@ -22,13 +22,10 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index)
|
|||
, m_ff_device(nullptr)
|
||||
{
|
||||
// Buttons
|
||||
NSDictionary *buttonDict =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
||||
@kIOHIDElementTypeKey,
|
||||
[NSNumber numberWithInteger: kHIDPage_Button],
|
||||
@kIOHIDElementUsagePageKey,
|
||||
nil];
|
||||
NSDictionary *buttonDict = @{
|
||||
@kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
||||
@kIOHIDElementUsagePageKey : [NSNumber numberWithInteger: kHIDPage_Button]
|
||||
};
|
||||
|
||||
CFArrayRef buttons = IOHIDDeviceCopyMatchingElements(m_device,
|
||||
(CFDictionaryRef)buttonDict, kIOHIDOptionsTypeNone);
|
||||
|
@ -47,11 +44,9 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index)
|
|||
}
|
||||
|
||||
// Axes
|
||||
NSDictionary *axisDict =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInteger: kIOHIDElementTypeInput_Misc],
|
||||
@kIOHIDElementTypeKey,
|
||||
nil];
|
||||
NSDictionary *axisDict = @{
|
||||
@kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Misc]
|
||||
};
|
||||
|
||||
CFArrayRef axes = IOHIDDeviceCopyMatchingElements(m_device,
|
||||
(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
|
||||
// Now, filter on just the buttons we can handle sanely
|
||||
NSDictionary *matchingElements =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
||||
@kIOHIDElementTypeKey,
|
||||
[NSNumber numberWithInteger: 0], @kIOHIDElementMinKey,
|
||||
[NSNumber numberWithInteger: 1], @kIOHIDElementMaxKey,
|
||||
nil];
|
||||
NSDictionary *matchingElements = @{
|
||||
@kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button],
|
||||
@kIOHIDElementMinKey : [NSNumber numberWithInteger: 0],
|
||||
@kIOHIDElementMaxKey : [NSNumber numberWithInteger: 1]
|
||||
};
|
||||
|
||||
CFArrayRef elements = IOHIDDeviceCopyMatchingElements(m_device,
|
||||
(CFDictionaryRef)matchingElements, kIOHIDOptionsTypeNone);
|
||||
|
|
Loading…
Reference in New Issue