objc2_game_controller/generated/
GCExtendedGamepad.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[cfg(all(
20 feature = "GCControllerElement",
21 feature = "GCPhysicalInputProfile",
22 feature = "block2"
23))]
24pub type GCExtendedGamepadValueChangedHandler =
25 *mut block2::DynBlock<dyn Fn(NonNull<GCExtendedGamepad>, NonNull<GCControllerElement>)>;
26
27extern_class!(
28 #[unsafe(super(GCPhysicalInputProfile, NSObject))]
30 #[derive(Debug, PartialEq, Eq, Hash)]
31 #[cfg(feature = "GCPhysicalInputProfile")]
32 pub struct GCExtendedGamepad;
33);
34
35#[cfg(feature = "GCPhysicalInputProfile")]
36extern_conformance!(
37 unsafe impl NSObjectProtocol for GCExtendedGamepad {}
38);
39
40#[cfg(feature = "GCPhysicalInputProfile")]
41impl GCExtendedGamepad {
42 extern_methods!(
43 #[cfg(feature = "GCController")]
44 #[unsafe(method(controller))]
46 #[unsafe(method_family = none)]
47 pub unsafe fn controller(&self) -> Option<Retained<GCController>>;
48
49 #[cfg(all(feature = "GCControllerElement", feature = "block2"))]
50 #[unsafe(method(valueChangedHandler))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn valueChangedHandler(&self) -> GCExtendedGamepadValueChangedHandler;
57
58 #[cfg(all(feature = "GCControllerElement", feature = "block2"))]
59 #[unsafe(method(setValueChangedHandler:))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn setValueChangedHandler(
69 &self,
70 value_changed_handler: GCExtendedGamepadValueChangedHandler,
71 );
72
73 #[cfg(feature = "GCExtendedGamepadSnapshot")]
74 #[deprecated = "Use the -[GCController capture] method instead"]
81 #[unsafe(method(saveSnapshot))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn saveSnapshot(&self) -> Retained<GCExtendedGamepadSnapshot>;
84
85 #[cfg(all(feature = "GCControllerDirectionPad", feature = "GCControllerElement"))]
86 #[unsafe(method(dpad))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn dpad(&self) -> Retained<GCControllerDirectionPad>;
90
91 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
92 #[unsafe(method(buttonA))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn buttonA(&self) -> Retained<GCControllerButtonInput>;
105
106 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
107 #[unsafe(method(buttonB))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn buttonB(&self) -> Retained<GCControllerButtonInput>;
110
111 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
112 #[unsafe(method(buttonX))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn buttonX(&self) -> Retained<GCControllerButtonInput>;
115
116 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
117 #[unsafe(method(buttonY))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn buttonY(&self) -> Retained<GCControllerButtonInput>;
120
121 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
122 #[unsafe(method(buttonMenu))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn buttonMenu(&self) -> Retained<GCControllerButtonInput>;
126
127 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
128 #[unsafe(method(buttonOptions))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn buttonOptions(&self) -> Option<Retained<GCControllerButtonInput>>;
132
133 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
134 #[unsafe(method(buttonHome))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn buttonHome(&self) -> Option<Retained<GCControllerButtonInput>>;
138
139 #[cfg(all(feature = "GCControllerDirectionPad", feature = "GCControllerElement"))]
140 #[unsafe(method(leftThumbstick))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn leftThumbstick(&self) -> Retained<GCControllerDirectionPad>;
144
145 #[cfg(all(feature = "GCControllerDirectionPad", feature = "GCControllerElement"))]
146 #[unsafe(method(rightThumbstick))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn rightThumbstick(&self) -> Retained<GCControllerDirectionPad>;
150
151 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
152 #[unsafe(method(leftShoulder))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn leftShoulder(&self) -> Retained<GCControllerButtonInput>;
156
157 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
158 #[unsafe(method(rightShoulder))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn rightShoulder(&self) -> Retained<GCControllerButtonInput>;
162
163 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
164 #[unsafe(method(leftTrigger))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn leftTrigger(&self) -> Retained<GCControllerButtonInput>;
168
169 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
170 #[unsafe(method(rightTrigger))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn rightTrigger(&self) -> Retained<GCControllerButtonInput>;
173
174 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
175 #[unsafe(method(leftThumbstickButton))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn leftThumbstickButton(&self) -> Option<Retained<GCControllerButtonInput>>;
179
180 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
181 #[unsafe(method(rightThumbstickButton))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn rightThumbstickButton(&self) -> Option<Retained<GCControllerButtonInput>>;
184
185 #[unsafe(method(setStateFromExtendedGamepad:))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn setStateFromExtendedGamepad(&self, extended_gamepad: &GCExtendedGamepad);
194 );
195}
196
197#[cfg(feature = "GCPhysicalInputProfile")]
199impl GCExtendedGamepad {
200 extern_methods!(
201 #[unsafe(method(init))]
202 #[unsafe(method_family = init)]
203 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
204
205 #[unsafe(method(new))]
206 #[unsafe(method_family = new)]
207 pub unsafe fn new() -> Retained<Self>;
208 );
209}