I'm looking to port an old mac game of mine to Apple TV. I need a dpad and a button. Do I only need to implement GCMicroGamepad to support the Apple TV Remote? There's no definate answer in the documentation. All I know is, "Game Controllers are not working with the simulator in this beta."
If I add support for this gamepad. Will I get my dpad and button support without having to implement any gesture recognizers?
You first have to run: GCController.startWirelessControllerDiscoveryWithCompletionHandler.
Then, setup: NSNotificationCenter.defaultCenter().addObserverForName(GCControllerDidConnectNotification, object: nil, queue: nil) { note in }
Inside the brackets, set your controller value to: GCController.controllers().first!
You can then access it at: controller.microGamepad
Furthermore, to access dpad values, create the following in the completion handler:
controller.microGamepad?.valueChangedHandler = { (gamepad, element) -> Void in
if element == controller.microGamepad?.dpad {
if controller.microGamepad?.dpad.left.value > 0.0 {
//Use your dpad.left.value code here
}
}
}Jackson