Trait GCPhysicalInputSource

Source
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 { ... }
}
Available on crate feature 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§

Source

unsafe fn elementAliases(&self) -> Retained<NSSet<NSString>>
where Self: Sized + Message,

Available on crate feature GCInputNames only.

The set of aliases for the element that the user interacts with.

Source

unsafe fn elementLocalizedName(&self) -> Option<Retained<NSString>>
where Self: Sized + Message,

The localized name of the element that the user interacts with.

Source

unsafe fn sfSymbolsName(&self) -> Option<Retained<NSString>>
where Self: Sized + Message,

The SF Symbol of the element that the user interacts with.

Source

unsafe fn direction(&self) -> GCPhysicalInputSourceDirection
where Self: Sized + Message,

One or more directions associated with the source.

Trait Implementations§

Source§

impl ProtocolType for dyn GCPhysicalInputSource

Source§

const NAME: &'static str = "GCPhysicalInputSource"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn GCPhysicalInputSource

Implementations on Foreign Types§

Source§

impl<T> GCPhysicalInputSource for ProtocolObject<T>

Implementors§