MCPcopy Create free account
hub / github.com/SFML/SFML / getDeviceUint

Function getDeviceUint

src/SFML/Window/macOS/JoystickImpl.cpp:69–82  ·  view source on GitHub ↗

Get HID device property key as an unsigned int

Source from the content-addressed store, hash-verified

67
68// Get HID device property key as an unsigned int
69unsigned int getDeviceUint(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index)
70{
71 CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop);
72 if (typeRef && (CFGetTypeID(typeRef) == CFNumberGetTypeID()))
73 {
74 SInt32 value = 0;
75 CFNumberGetValue(static_cast<CFNumberRef>(typeRef), kCFNumberSInt32Type, &value);
76 return static_cast<unsigned int>(value);
77 }
78
79 sf::err() << "Unable to read uint value for property '" << stringFromCFString(prop) << "' for joystick at index "
80 << index << std::endl;
81 return 0;
82}
83} // namespace
84
85

Callers 1

openMethod · 0.85

Calls 1

stringFromCFStringFunction · 0.85

Tested by

no test coverage detected