pub unsafe trait GCPhysicalInputSource: NSObjectProtocol {
// Provided methods
unsafe fn elementAliases(&self) -> Retained<NSSet<NSString>>
where Self: Sized + Message { ... }
unsafe fn elementLocalizedName(&self) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
unsafe fn sfSymbolsName(&self) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
unsafe fn direction(&self) -> GCPhysicalInputSourceDirection
where Self: Sized + Message { ... }
}GCPhysicalInputSource only.Expand description
A description of the actual physical input element that a user interacts with to manipulate the the value of an input that is exposed to the app.
By querying the source of an element’s input that is returned from
GCDevicePhysicalInputor
GCDevicePhysicalInputState,an app
can see through element remappings applied by the user in the system
game controller settings. For example, assuming the user has
swapped the A and B buttons in the system game controller settings…
YES == [physicalInput.buttonsGCInputButtonA.pressedInput.source.elementAliases contains:GCInputButtonB] YES == [physicalInput.buttonsGCInputButtonB.pressedInput.source.elementAliases contains:GCInputButtonA]
Examining an input’s source is discouraged, but may be necessary depending
on how your game’s input handling code is implemented. If possible, prefer
to load and display the
sfSymbolsNameand
localizedNamefrom the
GCPhysicalInputElementin any in-game U.I.
// Use these anywhere you need to instruct the user to press the ‘A’ // button in your game UI. The symbol name and localized string // returned will reflect the element that GCInputButtonA has been // remapped to (Button B in the above case). physicalInput.buttonsGCInputButtonA.localizedName physicalInput.buttonsGCInputButtonA.sfSymbolsName
Note: Objects conforming to
GCPhysicalInputSourceprotocol are vended by the
GameController framework. You should not conform to this protocol in your
own types.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn elementAliases(&self) -> Retained<NSSet<NSString>>
Available on crate feature GCInputNames only.
unsafe fn elementAliases(&self) -> Retained<NSSet<NSString>>
GCInputNames only.The set of aliases for the element that the user interacts with.
Sourceunsafe fn elementLocalizedName(&self) -> Option<Retained<NSString>>
unsafe fn elementLocalizedName(&self) -> Option<Retained<NSString>>
The localized name of the element that the user interacts with.
Sourceunsafe fn sfSymbolsName(&self) -> Option<Retained<NSString>>
unsafe fn sfSymbolsName(&self) -> Option<Retained<NSString>>
The SF Symbol of the element that the user interacts with.
Sourceunsafe fn direction(&self) -> GCPhysicalInputSourceDirection
unsafe fn direction(&self) -> GCPhysicalInputSourceDirection
One or more directions associated with the source.