objc2_game_controller/generated/
GCGamepad.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 GCGamepadValueChangedHandler =
25 *mut block2::DynBlock<dyn Fn(NonNull<GCGamepad>, NonNull<GCControllerElement>)>;
26
27extern_class!(
28 #[unsafe(super(GCPhysicalInputProfile, NSObject))]
30 #[derive(Debug, PartialEq, Eq, Hash)]
31 #[cfg(feature = "GCPhysicalInputProfile")]
32 #[deprecated]
33 pub struct GCGamepad;
34);
35
36#[cfg(feature = "GCPhysicalInputProfile")]
37extern_conformance!(
38 unsafe impl NSObjectProtocol for GCGamepad {}
39);
40
41#[cfg(feature = "GCPhysicalInputProfile")]
42impl GCGamepad {
43 extern_methods!(
44 #[cfg(feature = "GCController")]
45 #[deprecated]
47 #[unsafe(method(controller))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn controller(&self) -> Option<Retained<GCController>>;
50
51 #[cfg(all(feature = "GCControllerElement", feature = "block2"))]
52 #[deprecated]
57 #[unsafe(method(valueChangedHandler))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn valueChangedHandler(&self) -> GCGamepadValueChangedHandler;
60
61 #[cfg(all(feature = "GCControllerElement", feature = "block2"))]
62 #[deprecated]
70 #[unsafe(method(setValueChangedHandler:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn setValueChangedHandler(
73 &self,
74 value_changed_handler: GCGamepadValueChangedHandler,
75 );
76
77 #[cfg(feature = "GCGamepadSnapshot")]
78 #[deprecated]
85 #[unsafe(method(saveSnapshot))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn saveSnapshot(&self) -> Retained<GCGamepadSnapshot>;
88
89 #[cfg(all(feature = "GCControllerDirectionPad", feature = "GCControllerElement"))]
90 #[deprecated]
92 #[unsafe(method(dpad))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn dpad(&self) -> Retained<GCControllerDirectionPad>;
95
96 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
97 #[deprecated]
108 #[unsafe(method(buttonA))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn buttonA(&self) -> Retained<GCControllerButtonInput>;
111
112 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
113 #[deprecated]
114 #[unsafe(method(buttonB))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn buttonB(&self) -> Retained<GCControllerButtonInput>;
117
118 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
119 #[deprecated]
120 #[unsafe(method(buttonX))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn buttonX(&self) -> Retained<GCControllerButtonInput>;
123
124 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
125 #[deprecated]
126 #[unsafe(method(buttonY))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn buttonY(&self) -> Retained<GCControllerButtonInput>;
129
130 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
131 #[deprecated]
133 #[unsafe(method(leftShoulder))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn leftShoulder(&self) -> Retained<GCControllerButtonInput>;
136
137 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
138 #[deprecated]
140 #[unsafe(method(rightShoulder))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn rightShoulder(&self) -> Retained<GCControllerButtonInput>;
143 );
144}
145
146#[cfg(feature = "GCPhysicalInputProfile")]
148impl GCGamepad {
149 extern_methods!(
150 #[unsafe(method(init))]
151 #[unsafe(method_family = init)]
152 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154 #[unsafe(method(new))]
155 #[unsafe(method_family = new)]
156 pub unsafe fn new() -> Retained<Self>;
157 );
158}