objc2_game_controller/generated/
GCGamepad.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcgamepadvaluechangedhandler?language=objc)
10#[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    /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcgamepad?language=objc)
20    #[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        /// Setter for [`valueChangedHandler`][Self::valueChangedHandler].
47        #[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        /// Polls the state vector of the controller and saves it to a snapshot. The snapshot is stored in a device independent
57        /// format that can be serialized and used at a later date. This is useful for features such as quality assurance,
58        /// save game or replay functionality among many.
59        ///
60        /// If your application is heavily multithreaded this may also be useful to guarantee atomicity of input handling as
61        /// a snapshot will not change based on user input once it is taken.
62        #[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        /// Required to be analog in the Standard profile. All the elements of this directional input are thus analog.
69        #[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        /// All face buttons are required to be analog in the Standard profile. These must be arranged
76        /// in the diamond pattern given below:
77        ///
78        /// Y
79        /// /
80        /// \
81        /// X   B
82        /// \
83        /// /
84        /// A
85        #[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        /// Shoulder buttons are required to be analog inputs.
110        #[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        /// Shoulder buttons are required to be analog inputs.
117        #[deprecated]
118        #[unsafe(method(rightShoulder))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn rightShoulder(&self) -> Retained<GCControllerButtonInput>;
121    );
122}
123
124/// Methods declared on superclass `NSObject`.
125#[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}