objc2_game_controller/generated/
GCExtendedGamepadSnapshot.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(GCExtendedGamepad, GCPhysicalInputProfile, NSObject))]
24 #[derive(Debug, PartialEq, Eq, Hash)]
25 #[cfg(all(feature = "GCExtendedGamepad", feature = "GCPhysicalInputProfile"))]
26 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
27 pub struct GCExtendedGamepadSnapshot;
28);
29
30#[cfg(all(feature = "GCExtendedGamepad", feature = "GCPhysicalInputProfile"))]
31extern_conformance!(
32 unsafe impl NSObjectProtocol for GCExtendedGamepadSnapshot {}
33);
34
35#[cfg(all(feature = "GCExtendedGamepad", feature = "GCPhysicalInputProfile"))]
36impl GCExtendedGamepadSnapshot {
37 extern_methods!(
38 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
39 #[unsafe(method(snapshotData))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn snapshotData(&self) -> Retained<NSData>;
42
43 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
45 #[unsafe(method(setSnapshotData:))]
46 #[unsafe(method_family = none)]
47 pub unsafe fn setSnapshotData(&self, snapshot_data: &NSData);
48
49 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
50 #[unsafe(method(initWithSnapshotData:))]
51 #[unsafe(method_family = init)]
52 pub unsafe fn initWithSnapshotData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;
53
54 #[cfg(feature = "GCController")]
55 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
56 #[unsafe(method(initWithController:snapshotData:))]
57 #[unsafe(method_family = init)]
58 pub unsafe fn initWithController_snapshotData(
59 this: Allocated<Self>,
60 controller: &GCController,
61 data: &NSData,
62 ) -> Retained<Self>;
63 );
64}
65
66#[cfg(all(feature = "GCExtendedGamepad", feature = "GCPhysicalInputProfile"))]
68impl GCExtendedGamepadSnapshot {
69 extern_methods!(
70 #[unsafe(method(init))]
71 #[unsafe(method_family = init)]
72 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
73
74 #[unsafe(method(new))]
75 #[unsafe(method_family = new)]
76 pub unsafe fn new() -> Retained<Self>;
77 );
78}
79
80#[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
83#[repr(transparent)]
84#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
85pub struct GCExtendedGamepadSnapshotDataVersion(pub NSInteger);
86impl GCExtendedGamepadSnapshotDataVersion {
87 #[doc(alias = "GCExtendedGamepadSnapshotDataVersion1")]
88 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
89 pub const Version1: Self = Self(0x0100);
90 #[doc(alias = "GCExtendedGamepadSnapshotDataVersion2")]
91 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
92 pub const Version2: Self = Self(0x0101);
93}
94
95unsafe impl Encode for GCExtendedGamepadSnapshotDataVersion {
96 const ENCODING: Encoding = NSInteger::ENCODING;
97}
98
99unsafe impl RefEncode for GCExtendedGamepadSnapshotDataVersion {
100 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
101}
102
103extern "C" {
104 pub static GCCurrentExtendedGamepadSnapshotDataVersion: GCExtendedGamepadSnapshotDataVersion;
106}
107
108#[repr(C)]
110#[derive(Clone, Copy, Debug, PartialEq)]
111pub struct GCExtendedGamepadSnapshotData {
112 pub version: u16,
113 pub size: u16,
114 pub dpadX: c_float,
115 pub dpadY: c_float,
116 pub buttonA: c_float,
117 pub buttonB: c_float,
118 pub buttonX: c_float,
119 pub buttonY: c_float,
120 pub leftShoulder: c_float,
121 pub rightShoulder: c_float,
122 pub leftThumbstickX: c_float,
123 pub leftThumbstickY: c_float,
124 pub rightThumbstickX: c_float,
125 pub rightThumbstickY: c_float,
126 pub leftTrigger: c_float,
127 pub rightTrigger: c_float,
128 pub supportsClickableThumbsticks: Bool,
129 pub leftThumbstickButton: Bool,
130 pub rightThumbstickButton: Bool,
131}
132
133unsafe impl Encode for GCExtendedGamepadSnapshotData {
134 const ENCODING: Encoding = Encoding::Struct(
135 "?",
136 &[
137 <u16>::ENCODING,
138 <u16>::ENCODING,
139 <c_float>::ENCODING,
140 <c_float>::ENCODING,
141 <c_float>::ENCODING,
142 <c_float>::ENCODING,
143 <c_float>::ENCODING,
144 <c_float>::ENCODING,
145 <c_float>::ENCODING,
146 <c_float>::ENCODING,
147 <c_float>::ENCODING,
148 <c_float>::ENCODING,
149 <c_float>::ENCODING,
150 <c_float>::ENCODING,
151 <c_float>::ENCODING,
152 <c_float>::ENCODING,
153 <Bool>::ENCODING,
154 <Bool>::ENCODING,
155 <Bool>::ENCODING,
156 ],
157 );
158}
159
160unsafe impl RefEncode for GCExtendedGamepadSnapshotData {
161 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
162}
163
164impl GCExtendedGamepadSnapshotData {
165 #[doc(alias = "GCExtendedGamepadSnapshotDataFromNSData")]
170 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
171 #[inline]
172 pub unsafe fn from_ns_data(
173 snapshot_data: *mut GCExtendedGamepadSnapshotData,
174 data: Option<&NSData>,
175 ) -> bool {
176 extern "C-unwind" {
177 fn GCExtendedGamepadSnapshotDataFromNSData(
178 snapshot_data: *mut GCExtendedGamepadSnapshotData,
179 data: Option<&NSData>,
180 ) -> Bool;
181 }
182 unsafe { GCExtendedGamepadSnapshotDataFromNSData(snapshot_data, data) }.as_bool()
183 }
184}
185
186#[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
192#[inline]
193pub unsafe extern "C-unwind" fn NSDataFromGCExtendedGamepadSnapshotData(
194 snapshot_data: *mut GCExtendedGamepadSnapshotData,
195) -> Option<Retained<NSData>> {
196 extern "C-unwind" {
197 fn NSDataFromGCExtendedGamepadSnapshotData(
198 snapshot_data: *mut GCExtendedGamepadSnapshotData,
199 ) -> *mut NSData;
200 }
201 let ret = unsafe { NSDataFromGCExtendedGamepadSnapshotData(snapshot_data) };
202 unsafe { Retained::retain_autoreleased(ret) }
203}
204
205#[repr(C)]
207#[derive(Clone, Copy, Debug, PartialEq)]
208pub struct GCExtendedGamepadSnapShotDataV100 {
209 pub version: u16,
210 pub size: u16,
211 pub dpadX: c_float,
212 pub dpadY: c_float,
213 pub buttonA: c_float,
214 pub buttonB: c_float,
215 pub buttonX: c_float,
216 pub buttonY: c_float,
217 pub leftShoulder: c_float,
218 pub rightShoulder: c_float,
219 pub leftThumbstickX: c_float,
220 pub leftThumbstickY: c_float,
221 pub rightThumbstickX: c_float,
222 pub rightThumbstickY: c_float,
223 pub leftTrigger: c_float,
224 pub rightTrigger: c_float,
225}
226
227unsafe impl Encode for GCExtendedGamepadSnapShotDataV100 {
228 const ENCODING: Encoding = Encoding::Struct(
229 "?",
230 &[
231 <u16>::ENCODING,
232 <u16>::ENCODING,
233 <c_float>::ENCODING,
234 <c_float>::ENCODING,
235 <c_float>::ENCODING,
236 <c_float>::ENCODING,
237 <c_float>::ENCODING,
238 <c_float>::ENCODING,
239 <c_float>::ENCODING,
240 <c_float>::ENCODING,
241 <c_float>::ENCODING,
242 <c_float>::ENCODING,
243 <c_float>::ENCODING,
244 <c_float>::ENCODING,
245 <c_float>::ENCODING,
246 <c_float>::ENCODING,
247 ],
248 );
249}
250
251unsafe impl RefEncode for GCExtendedGamepadSnapShotDataV100 {
252 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
253}
254
255impl GCExtendedGamepadSnapShotDataV100 {
256 #[doc(alias = "GCExtendedGamepadSnapShotDataV100FromNSData")]
261 #[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
262 #[inline]
263 pub unsafe fn from_ns_data(
264 snapshot_data: *mut GCExtendedGamepadSnapShotDataV100,
265 data: Option<&NSData>,
266 ) -> bool {
267 extern "C-unwind" {
268 fn GCExtendedGamepadSnapShotDataV100FromNSData(
269 snapshot_data: *mut GCExtendedGamepadSnapShotDataV100,
270 data: Option<&NSData>,
271 ) -> Bool;
272 }
273 unsafe { GCExtendedGamepadSnapShotDataV100FromNSData(snapshot_data, data) }.as_bool()
274 }
275}
276
277#[deprecated = "Use the -[GCController controllerWithExtendedGamepad] method instead"]
283#[inline]
284pub unsafe extern "C-unwind" fn NSDataFromGCExtendedGamepadSnapShotDataV100(
285 snapshot_data: *mut GCExtendedGamepadSnapShotDataV100,
286) -> Option<Retained<NSData>> {
287 extern "C-unwind" {
288 fn NSDataFromGCExtendedGamepadSnapShotDataV100(
289 snapshot_data: *mut GCExtendedGamepadSnapShotDataV100,
290 ) -> *mut NSData;
291 }
292 let ret = unsafe { NSDataFromGCExtendedGamepadSnapShotDataV100(snapshot_data) };
293 unsafe { Retained::retain_autoreleased(ret) }
294}
295
296#[deprecated = "renamed to `GCExtendedGamepadSnapshotData::from_ns_data`"]
297#[inline]
298pub unsafe extern "C-unwind" fn GCExtendedGamepadSnapshotDataFromNSData(
299 snapshot_data: *mut GCExtendedGamepadSnapshotData,
300 data: Option<&NSData>,
301) -> bool {
302 extern "C-unwind" {
303 fn GCExtendedGamepadSnapshotDataFromNSData(
304 snapshot_data: *mut GCExtendedGamepadSnapshotData,
305 data: Option<&NSData>,
306 ) -> Bool;
307 }
308 unsafe { GCExtendedGamepadSnapshotDataFromNSData(snapshot_data, data) }.as_bool()
309}
310
311#[deprecated = "renamed to `GCExtendedGamepadSnapShotDataV100::from_ns_data`"]
312#[inline]
313pub unsafe extern "C-unwind" fn GCExtendedGamepadSnapShotDataV100FromNSData(
314 snapshot_data: *mut GCExtendedGamepadSnapShotDataV100,
315 data: Option<&NSData>,
316) -> bool {
317 extern "C-unwind" {
318 fn GCExtendedGamepadSnapShotDataV100FromNSData(
319 snapshot_data: *mut GCExtendedGamepadSnapShotDataV100,
320 data: Option<&NSData>,
321 ) -> Bool;
322 }
323 unsafe { GCExtendedGamepadSnapShotDataV100FromNSData(snapshot_data, data) }.as_bool()
324}