SKUGCControllerController
IntroductionNot intended for you to create instances of this class but instead to be able to control controller related functions through the SKUtilities singleton. See the see also above. Methods
canPlayerControlNav:-(BOOL)canPlayerControlNav:(GCControllerPlayerIndex)player; DiscussionReturns boolean answering whether a particular player is allowed to control navigation set via the flag validPlayerNav. See Also checkForChangedControllerState-(void)checkForChangedControllerState; DiscussionCalled automatically when a controller connects or disconnects, but can also be called manually if you want to. gamepadForPlayer:-(GCController*)gamepadForPlayer:(GCControllerPlayerIndex)player; ParametersReturn ValueGCController object designated for the player. DiscussionFinds the GCController object for a given player. Returns nil if not found. gamepadForVendor:-(GCController*)gamepadForVendor:(NSString*)vendor; DiscussionReturns the first GCController object found for a given vendor string. Returns nil if not found. setPlayerOne:-(void)setPlayerOne:(GCController*)controller; ParametersDiscussionAllows you to set which controller is player one and then fills in the rest automatically. This is primarily intended for convenience on the AppleTV if you want to turn the Siri remote to player two and allow the gamepad to take over as P1. PropertiescontrollerStates@property (nonatomic, strong, readonly) NSArray<SKUGameControllerState*>* controllerStates; DiscussionArray with a designated controller state for each player. These are initialized and updated automatically. navControllerState@property (nonatomic, strong) SKUGameControllerState* navControllerState; DiscussionUsed for access to the current controller state for navigation purposes. Internal. playerControllers@property (nonatomic, strong) NSMutableArray* playerControllers; DiscussionArray with controller objects in the order of players. Note that it's not readonly and is mutable, but do NOT change it. It's this way for internal reasons: it's only intended for you to read from this array. validPlayerNav@property (nonatomic) uint8_t validPlayerNav; DiscussionFlags determining which players are allowed to control navigation. Note that Siri Remote ALWAYS gets to control nav. See Also view@property (nonatomic, weak) SKView* view; DiscussionSet automatically when setting the [SKUtilities setNavFocus] method on the scene itself or if you call [super didMoveToView] on an SKUScene. Note that this is only set if the gcController object has already been initialized (which happens automatically if you use SKUScene). If the view ever gets changed, you will need to update this property with the current view and call "checkForChangedControllerState" again (untested, but I think should work). |