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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
//! 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::*;
use crate::*;
/// The number of discrete control positions supported by the DualSense adaptive triggers. Each of these positions can be configured separately in multi-position feedback and multi-position vibration modes.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdualsenseadaptivetriggerdiscretepositioncount?language=objc)
pub const GCDualSenseAdaptiveTriggerDiscretePositionCount: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdualsenseadaptivetriggermode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GCDualSenseAdaptiveTriggerMode(pub NSInteger);
impl GCDualSenseAdaptiveTriggerMode {
/// The adaptive trigger effect is disabled.
#[doc(alias = "GCDualSenseAdaptiveTriggerModeOff")]
pub const Off: Self = Self(0);
/// The adaptive trigger effect provides constant feedback from the start position onwards.
#[doc(alias = "GCDualSenseAdaptiveTriggerModeFeedback")]
pub const Feedback: Self = Self(1);
/// The adaptive trigger effect provides feedback from the start position to the end position, emulating the feeling of pulling the trigger on a weapon.
#[doc(alias = "GCDualSenseAdaptiveTriggerModeWeapon")]
pub const Weapon: Self = Self(2);
/// The adaptive trigger effect provides a constant vibration effect from the start position onwards.
#[doc(alias = "GCDualSenseAdaptiveTriggerModeVibration")]
pub const Vibration: Self = Self(3);
/// The adaptive trigger effect provides feedback from the start position to the end position, linearly interpolated between the start and end strengths.
#[doc(alias = "GCDualSenseAdaptiveTriggerModeSlopeFeedback")]
pub const SlopeFeedback: Self = Self(4);
}
unsafe impl Encode for GCDualSenseAdaptiveTriggerMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for GCDualSenseAdaptiveTriggerMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdualsenseadaptivetriggerstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GCDualSenseAdaptiveTriggerStatus(pub NSInteger);
impl GCDualSenseAdaptiveTriggerStatus {
/// The adaptive trigger status cannot be determined.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusUnknown")]
pub const Unknown: Self = Self(-1);
/// The adaptive trigger is in feedback mode, and a resistive load has not been applied yet.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusFeedbackNoLoad")]
pub const FeedbackNoLoad: Self = Self(0);
/// The adaptive trigger is in feedback mode, and a resistive load is applied.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusFeedbackLoadApplied")]
pub const FeedbackLoadApplied: Self = Self(1);
/// The adaptive trigger is in weapon mode, the trigger is ready to fire, and a resistive load has not been applied yet.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusWeaponReady")]
pub const WeaponReady: Self = Self(2);
/// The adaptive trigger is in weapon mode, the trigger is firing, and a resistive load is currently being applied.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusWeaponFiring")]
pub const WeaponFiring: Self = Self(3);
/// The adaptive trigger is in weapon mode, the trigger has fired, and a resistive load is no longer being applied.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusWeaponFired")]
pub const WeaponFired: Self = Self(4);
/// The adaptive trigger is in vibration mode, and the trigger is not vibrating.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusVibrationNotVibrating")]
pub const VibrationNotVibrating: Self = Self(5);
/// The adaptive trigger is in vibration mode, and the trigger is currently vibrating.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusVibrationIsVibrating")]
pub const VibrationIsVibrating: Self = Self(6);
/// The adaptive trigger is in slope feedback mode, the trigger is ready to apply a resistive load, but a resistive load has not been applied yet.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusSlopeFeedbackReady")]
pub const SlopeFeedbackReady: Self = Self(7);
/// The adaptive trigger is in slope feedback mode, and a resistive load is currently being applied to the trigger.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusSlopeFeedbackApplyingLoad")]
pub const SlopeFeedbackApplyingLoad: Self = Self(8);
/// The adaptive trigger is in slope feedback mode, a resistive load has previously been applied, but is no longer being applied.
#[doc(alias = "GCDualSenseAdaptiveTriggerStatusSlopeFeedbackFinished")]
pub const SlopeFeedbackFinished: Self = Self(9);
}
unsafe impl Encode for GCDualSenseAdaptiveTriggerStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for GCDualSenseAdaptiveTriggerStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdualsenseadaptivetriggerpositionalamplitudes?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct GCDualSenseAdaptiveTriggerPositionalAmplitudes {
/// An array of amplitudes associated with the GCDualSenseAdaptiveTriggerDiscretePositionCount control positions supported by the DualSense adaptive triggers.
pub values: [c_float; 10],
}
unsafe impl Encode for GCDualSenseAdaptiveTriggerPositionalAmplitudes {
const ENCODING: Encoding = Encoding::Struct("?", &[<[c_float; 10]>::ENCODING]);
}
unsafe impl RefEncode for GCDualSenseAdaptiveTriggerPositionalAmplitudes {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdualsenseadaptivetriggerpositionalresistivestrengths?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct GCDualSenseAdaptiveTriggerPositionalResistiveStrengths {
/// An array of resistive strengths associated with the GCDualSenseAdaptiveTriggerDiscretePositionCount control positions supported by the DualSense adaptive triggers.
pub values: [c_float; 10],
}
unsafe impl Encode for GCDualSenseAdaptiveTriggerPositionalResistiveStrengths {
const ENCODING: Encoding = Encoding::Struct("?", &[<[c_float; 10]>::ENCODING]);
}
unsafe impl RefEncode for GCDualSenseAdaptiveTriggerPositionalResistiveStrengths {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// DualSense triggers are required to be analog inputs. Common uses would be acceleration and decelleration in a driving game for example.
///
/// GCDualSenseAdaptiveTrigger represents an adaptive trigger on the Sony DualSense controller, allowing you to specify a dynamic resistance force
/// that is applied when pulling the trigger. This can, for example, be used to emulate the feeling of pulling back a bow string, firing a weapon, or pulling a lever.
///
///
/// See: GCDualSenseGamepad
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdualsenseadaptivetrigger?language=objc)
#[unsafe(super(GCControllerButtonInput, GCControllerElement, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
pub struct GCDualSenseAdaptiveTrigger;
);
#[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
extern_conformance!(
unsafe impl NSObjectProtocol for GCDualSenseAdaptiveTrigger {}
);
#[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
impl GCDualSenseAdaptiveTrigger {
extern_methods!(
/// The mode that the adaptive trigger is currently in. This property reflects the physical state of the triggers - and requires a response from the controller.
/// It does not update immediately after calling -[GCDualSenseAdaptiveTrigger setMode...].
///
///
/// See: GCDualSenseAdaptiveTriggerMode
#[unsafe(method(mode))]
#[unsafe(method_family = none)]
pub unsafe fn mode(&self) -> GCDualSenseAdaptiveTriggerMode;
/// The current status of the adaptive trigger - whether it is ready to apply a load, is currently applying a load, or has finished applying a load.
///
///
/// See: GCDualSenseAdaptiveTriggerStatus
#[unsafe(method(status))]
#[unsafe(method_family = none)]
pub unsafe fn status(&self) -> GCDualSenseAdaptiveTriggerStatus;
/// A normalized float from [0-1], with 0 representing the lowest possible trigger arm position and 1 representing the maximum trigger arm position.
///
///
/// See: GCDualSenseAdaptiveTriggerStatus
#[unsafe(method(armPosition))]
#[unsafe(method_family = none)]
pub unsafe fn armPosition(&self) -> c_float;
/// Sets the adaptive trigger to slope feedback mode. The start position, end position, start strength, and end strength of the effect can be set arbitrarily; however the end position must be larger than the start position.
/// The trigger arm will provide a linearly interpolated degree of feedback whenever it is depressed between the start and end positions based on the starting and ending strengths.
///
///
/// Parameter `startPosition`: - A normalized float from [0-1], with 0 representing the smallest possible trigger depression and 1 representing the maximum trigger depression. The effect will begin once the trigger is depressed beyond this point.
///
/// Parameter `endPosition`: - A normalized float from [0-1], with 0 representing the smallest possible depression and 1 representing the maximum trigger depression. Must be greater than startPosition. The effect will end once the trigger is depressed beyond this point.
///
/// Parameter `startStrength`: - A normalized float from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength. The effect will begin at startStrength once the trigger is depressed beyond startPosition.
///
/// Parameter `endStrength`: - A normalized float from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength. The effect will end at endStrength once the trigger is depressed to endPosition.
#[unsafe(method(setModeSlopeFeedbackWithStartPosition:endPosition:startStrength:endStrength:))]
#[unsafe(method_family = none)]
pub unsafe fn setModeSlopeFeedbackWithStartPosition_endPosition_startStrength_endStrength(
&self,
start_position: c_float,
end_position: c_float,
start_strength: c_float,
end_strength: c_float,
);
/// Sets the adaptive trigger to feedback mode. The start position and strength of the effect can be set arbitrarily. The trigger arm will continue to provide a
/// constant degree of feedback whenever it is depressed further than the start position.
///
///
/// Parameter `startPosition`: - A normalized float from [0-1], with 0 representing the smallest possible trigger depression and 1 representing the maximum trigger depression.
///
/// Parameter `resistiveStrength`: - A normalized float from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength.
#[unsafe(method(setModeFeedbackWithStartPosition:resistiveStrength:))]
#[unsafe(method_family = none)]
pub unsafe fn setModeFeedbackWithStartPosition_resistiveStrength(
&self,
start_position: c_float,
resistive_strength: c_float,
);
/// Sets the adaptive trigger to feedback mode. The strength of the effect can be set for each possible trigger position. The trigger arm will provide a degree of feedback based on the resistive strength for a given position.
///
///
/// Parameter `positionalResistiveStrengths`: - Positional normalized floats from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength.
#[unsafe(method(setModeFeedbackWithResistiveStrengths:))]
#[unsafe(method_family = none)]
pub unsafe fn setModeFeedbackWithResistiveStrengths(
&self,
positional_resistive_strengths: GCDualSenseAdaptiveTriggerPositionalResistiveStrengths,
);
/// Sets the adaptive trigger to weapon mode. The start position, end position, and strength of the effect can be set arbitrarily; however the end position must be larger than the start position.
/// The trigger arm will continue to provide a constant degree of feedback whenever it is depressed further than the start position. Once the trigger arm has been depressed past the end
/// position, the strength of the effect will immediately fall to zero, providing a "sense of release" similar to that provided by pulling the trigger of a weapon.
///
///
/// Parameter `startPosition`: - A normalized float from [0-1], with 0 representing the smallest possible depression and 1 representing the maximum trigger depression. The effect will begin once the trigger is depressed beyond this point.
///
/// Parameter `endPosition`: - A normalized float from [0-1], with 0 representing the smallest possible depression and 1 representing the maximum trigger depression. Must be greater than startPosition. The effect will end once the trigger is depressed beyond this point.
///
/// Parameter `resistiveStrength`: - A normalized float from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength.
#[unsafe(method(setModeWeaponWithStartPosition:endPosition:resistiveStrength:))]
#[unsafe(method_family = none)]
pub unsafe fn setModeWeaponWithStartPosition_endPosition_resistiveStrength(
&self,
start_position: c_float,
end_position: c_float,
resistive_strength: c_float,
);
/// Sets the adaptive trigger to vibration mode. The start position, amplitude, and frequency of the effect can be set arbitrarily. The trigger arm will continue to strike against
/// the trigger whenever it is depressed further than the start position, providing a "sense of vibration".
///
///
/// Parameter `startPosition`: - A normalized float from [0-1], with 0 representing the smallest possible depression and 1 representing the maximum trigger depression. The effect will begin once the trigger is depressed beyond this point.
///
/// Parameter `amplitude`: - A normalized float from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength.
///
/// Parameter `frequency`: - A normalized float from [0-1], with 0 representing the minimum frequency and 1 representing the maximum frequency of the vibration effect.
#[unsafe(method(setModeVibrationWithStartPosition:amplitude:frequency:))]
#[unsafe(method_family = none)]
pub unsafe fn setModeVibrationWithStartPosition_amplitude_frequency(
&self,
start_position: c_float,
amplitude: c_float,
frequency: c_float,
);
/// Sets the adaptive trigger to vibration mode. The amplitude of the effect can be set for each possible trigger position. The trigger arm will provide a degree of feedback based on the amplitude for a given position. The trigger arm will continue to strike against the trigger, providing a "sense of vibration".
///
///
/// Parameter `positionalAmplitudes`: - Positional normalized floats from [0-1], with 0 representing the minimum effect strength (off entirely) and 1 representing the maximum effect strength.
///
/// Parameter `frequency`: - A normalized float from [0-1], with 0 representing the minimum frequency and 1 representing the maximum frequency of the vibration effect.
#[unsafe(method(setModeVibrationWithAmplitudes:frequency:))]
#[unsafe(method_family = none)]
pub unsafe fn setModeVibrationWithAmplitudes_frequency(
&self,
positional_amplitudes: GCDualSenseAdaptiveTriggerPositionalAmplitudes,
frequency: c_float,
);
/// Sets the adaptive trigger to off mode. This turns off the adaptive trigger effect.
#[unsafe(method(setModeOff))]
#[unsafe(method_family = none)]
pub unsafe fn setModeOff(&self);
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
impl GCDualSenseAdaptiveTrigger {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}