objc2_game_controller/generated/
GCGamepad.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[cfg(all(
11 feature = "GCControllerElement",
12 feature = "GCPhysicalInputProfile",
13 feature = "block2"
14))]
15pub type GCGamepadValueChangedHandler =
16 *mut block2::Block<dyn Fn(NonNull<GCGamepad>, NonNull<GCControllerElement>)>;
17
18extern_class!(
19 #[unsafe(super(GCPhysicalInputProfile, NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 #[cfg(feature = "GCPhysicalInputProfile")]
23 #[deprecated]
24 pub struct GCGamepad;
25);
26
27#[cfg(feature = "GCPhysicalInputProfile")]
28unsafe impl NSObjectProtocol for GCGamepad {}
29
30#[cfg(feature = "GCPhysicalInputProfile")]
31impl GCGamepad {
32 extern_methods!(
33 #[cfg(feature = "GCController")]
34 #[deprecated]
35 #[unsafe(method(controller))]
36 #[unsafe(method_family = none)]
37 pub unsafe fn controller(&self) -> Option<Retained<GCController>>;
38
39 #[cfg(all(feature = "GCControllerElement", feature = "block2"))]
40 #[deprecated]
41 #[unsafe(method(valueChangedHandler))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn valueChangedHandler(&self) -> GCGamepadValueChangedHandler;
44
45 #[cfg(all(feature = "GCControllerElement", feature = "block2"))]
46 #[deprecated]
48 #[unsafe(method(setValueChangedHandler:))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn setValueChangedHandler(
51 &self,
52 value_changed_handler: GCGamepadValueChangedHandler,
53 );
54
55 #[cfg(feature = "GCGamepadSnapshot")]
56 #[deprecated]
63 #[unsafe(method(saveSnapshot))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn saveSnapshot(&self) -> Retained<GCGamepadSnapshot>;
66
67 #[cfg(all(feature = "GCControllerDirectionPad", feature = "GCControllerElement"))]
68 #[deprecated]
70 #[unsafe(method(dpad))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn dpad(&self) -> Retained<GCControllerDirectionPad>;
73
74 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
75 #[deprecated]
86 #[unsafe(method(buttonA))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn buttonA(&self) -> Retained<GCControllerButtonInput>;
89
90 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
91 #[deprecated]
92 #[unsafe(method(buttonB))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn buttonB(&self) -> Retained<GCControllerButtonInput>;
95
96 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
97 #[deprecated]
98 #[unsafe(method(buttonX))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn buttonX(&self) -> Retained<GCControllerButtonInput>;
101
102 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
103 #[deprecated]
104 #[unsafe(method(buttonY))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn buttonY(&self) -> Retained<GCControllerButtonInput>;
107
108 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
109 #[deprecated]
111 #[unsafe(method(leftShoulder))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn leftShoulder(&self) -> Retained<GCControllerButtonInput>;
114
115 #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
116 #[deprecated]
118 #[unsafe(method(rightShoulder))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn rightShoulder(&self) -> Retained<GCControllerButtonInput>;
121 );
122}
123
124#[cfg(feature = "GCPhysicalInputProfile")]
126impl GCGamepad {
127 extern_methods!(
128 #[unsafe(method(init))]
129 #[unsafe(method_family = init)]
130 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
131
132 #[unsafe(method(new))]
133 #[unsafe(method_family = new)]
134 pub unsafe fn new() -> Retained<Self>;
135 );
136}