1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
/// One or more directions associated with a
/// `GCPhysicalInputSource.`
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcphysicalinputsourcedirection?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GCPhysicalInputSourceDirection(pub NSUInteger);
bitflags::bitflags! {
impl GCPhysicalInputSourceDirection: NSUInteger {
#[doc(alias = "GCPhysicalInputSourceDirectionNotApplicable")]
const NotApplicable = 0;
#[doc(alias = "GCPhysicalInputSourceDirectionUp")]
const Up = 1<<0;
#[doc(alias = "GCPhysicalInputSourceDirectionRight")]
const Right = 1<<1;
#[doc(alias = "GCPhysicalInputSourceDirectionDown")]
const Down = 1<<2;
#[doc(alias = "GCPhysicalInputSourceDirectionLeft")]
const Left = 1<<3;
}
}
unsafe impl Encode for GCPhysicalInputSourceDirection {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for GCPhysicalInputSourceDirection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
/// 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
/// `GCDevicePhysicalInput`or
/// `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.buttons[GCInputButtonA].pressedInput.source.elementAliases contains:GCInputButtonB]
/// YES == [physicalInput.buttons[GCInputButtonB].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
/// `sfSymbolsName`and
/// `localizedName`from the
/// `GCPhysicalInputElement`in 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.buttons[GCInputButtonA].localizedName
/// physicalInput.buttons[GCInputButtonA].sfSymbolsName
///
///
/// Note: Objects conforming to
/// `GCPhysicalInputSource`protocol are vended by the
/// GameController framework. You should not conform to this protocol in your
/// own types.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcphysicalinputsource?language=objc)
pub unsafe trait GCPhysicalInputSource: NSObjectProtocol {
#[cfg(feature = "GCInputNames")]
/// The set of aliases for the element that the user interacts with.
#[unsafe(method(elementAliases))]
#[unsafe(method_family = none)]
unsafe fn elementAliases(&self) -> Retained<NSSet<NSString>>;
/// The localized name of the element that the user interacts with.
#[unsafe(method(elementLocalizedName))]
#[unsafe(method_family = none)]
unsafe fn elementLocalizedName(&self) -> Option<Retained<NSString>>;
/// The SF Symbol of the element that the user interacts with.
#[unsafe(method(sfSymbolsName))]
#[unsafe(method_family = none)]
unsafe fn sfSymbolsName(&self) -> Option<Retained<NSString>>;
/// One or more directions associated with the source.
#[unsafe(method(direction))]
#[unsafe(method_family = none)]
unsafe fn direction(&self) -> GCPhysicalInputSourceDirection;
}
);