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