Racing wheel device support
Add support for racing wheel devices in macOS.
Overview
For macOS apps that support racing wheel devices, follow these steps for your app:
If you distribute your app through the Mac App Store, add the com.apple.security.device.usb entitlement to your Xcode project.
To get a racing wheel controller object, register for the GCRacingWheelDidConnect (Swift) or GCRacingWheelDidConnectNotification (Objective-C) and GCRacingWheelDidDisconnect (Swift) or GCRacingWheelDidDisconnectNotification (Objective-C) notifications. Alternatively, check the
GCRacingWheelconnectedRacingWheels class property for the currently connected controllers.To start receiving input from a racing wheel controller, invoke the
GCRacingWheelacquireDevice() method. Then use the relinquishDevice() method when you finish processing input.To process the input, set callbacks for the specific racing wheel elements that you want to receive input from. For example, set the valueDidChangeHandler property of the steering wheel and accelerator pedal elements. Get these elements using the wheel and acceleratorPedal properties of the racing wheel’s wheelInput property, as in:
racingWheel.wheelInput.wheel.If you just want the latest value of the steering wheel, use the
GCSteeringWheelElementabsoluteInput property.For games that poll for input, set the input buffer size using the inputStateQueueDepth property. In each iteration of your game loop, repeatedly invoke the nextInputState() method until the queue is empty and it returns
nil.