objc2_game_controller/generated/GCDeviceHaptics.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#[cfg(feature = "objc2-core-haptics")]
7#[cfg(any(target_os = "ios", target_os = "tvos", target_os = "visionos"))]
8use objc2_core_haptics::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13/// A GCHapticsLocality represents the locations of haptic actuators on a controller. You can create a haptic engine with a given
14/// GCHapticsLocality, and any patterns you send to that engine will play on all specified actuators.
15///
16/// ```text
17/// CHHapticEngine *engine = [controller.haptics createEngineWithLocality:GCHapticsLocalityDefault];
18/// ```
19///
20///
21/// See: GCDeviceHaptics
22///
23/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocality?language=objc)
24// NS_TYPED_ENUM
25pub type GCHapticsLocality = NSString;
26
27extern "C" {
28 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalitydefault?language=objc)
29 pub static GCHapticsLocalityDefault: &'static GCHapticsLocality;
30}
31
32extern "C" {
33 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalityall?language=objc)
34 pub static GCHapticsLocalityAll: &'static GCHapticsLocality;
35}
36
37extern "C" {
38 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalityhandles?language=objc)
39 pub static GCHapticsLocalityHandles: &'static GCHapticsLocality;
40}
41
42extern "C" {
43 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalitylefthandle?language=objc)
44 pub static GCHapticsLocalityLeftHandle: &'static GCHapticsLocality;
45}
46
47extern "C" {
48 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalityrighthandle?language=objc)
49 pub static GCHapticsLocalityRightHandle: &'static GCHapticsLocality;
50}
51
52extern "C" {
53 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalitytriggers?language=objc)
54 pub static GCHapticsLocalityTriggers: &'static GCHapticsLocality;
55}
56
57extern "C" {
58 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalitylefttrigger?language=objc)
59 pub static GCHapticsLocalityLeftTrigger: &'static GCHapticsLocality;
60}
61
62extern "C" {
63 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticslocalityrighttrigger?language=objc)
64 pub static GCHapticsLocalityRightTrigger: &'static GCHapticsLocality;
65}
66
67extern "C" {
68 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gchapticdurationinfinite?language=objc)
69 pub static GCHapticDurationInfinite: c_float;
70}
71
72extern_class!(
73 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdevicehaptics?language=objc)
74 #[unsafe(super(NSObject))]
75 #[derive(Debug, PartialEq, Eq, Hash)]
76 pub struct GCDeviceHaptics;
77);
78
79extern_conformance!(
80 unsafe impl NSObjectProtocol for GCDeviceHaptics {}
81);
82
83impl GCDeviceHaptics {
84 extern_methods!(
85 /// The set of supported haptic localities for this device - representing the locations of its haptic actuators.
86 ///
87 ///
88 /// Note: GCHapticsLocalityDefault and GCHapticsLocalityAll are guaranteed to be supported - and they may be equivalent.
89 ///
90 ///
91 /// See: GCHapticsLocality
92 #[unsafe(method(supportedLocalities))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn supportedLocalities(&self) -> Retained<NSSet<GCHapticsLocality>>;
95
96 #[unsafe(method(init))]
97 #[unsafe(method_family = init)]
98 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99
100 #[cfg(feature = "objc2-core-haptics")]
101 #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "visionos"))]
102 /// Creates and returns a new instance of CHHapticEngine with a given GCHapticsLocality. Any patterns you send to this engine will play on
103 /// all specified actuators.
104 ///
105 ///
106 /// Note: Often times, it is best to use GCHapticsLocalityDefault. Engines created with the default locality will give users an expected
107 /// haptic experience. On most game controllers, this will cause your haptic patterns to play on the handles. If you want to play different
108 /// experiences on different actuators (for example, using the left handle actuator as a woofer and the right actuator as a tweeter), you can
109 /// create multiple engines (for example, one with a GCHapticsLocalityLeftHandle locality and another with a GCHapticsLocalityRightHandle
110 /// locality).
111 ///
112 ///
113 /// See: CHHapticEngine
114 ///
115 /// See: GCHapticsLocality
116 #[unsafe(method(createEngineWithLocality:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn createEngineWithLocality(
119 &self,
120 locality: &GCHapticsLocality,
121 ) -> Option<Retained<CHHapticEngine>>;
122 );
123}
124
125/// Methods declared on superclass `NSObject`.
126impl GCDeviceHaptics {
127 extern_methods!(
128 #[unsafe(method(new))]
129 #[unsafe(method_family = new)]
130 pub unsafe fn new() -> Retained<Self>;
131 );
132}