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
//! 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 objc2_foundation::*;
use crate::*;
extern_protocol!(
/// An object conforming to
/// `GCRelativeInput`represents an input that reports
/// its change in position along an axis (delta) since the previous event.
/// Relative inputs have no fixed origin from which a coordinate syatem can be
/// defined.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcrelativeinput?language=objc)
pub unsafe trait GCRelativeInput: NSObjectProtocol {
#[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
/// Set this block to be notified when the delta of the input changes.
///
///
/// Parameter `delta`: The amount that the input has changed since the last time
/// `deltaDidChangeHandler`fired.
///
/// # Safety
///
/// - The returned block's argument 1 must be a valid pointer.
/// - The returned block's argument 2 must be a valid pointer.
#[unsafe(method(deltaDidChangeHandler))]
#[unsafe(method_family = none)]
unsafe fn deltaDidChangeHandler(
&self,
) -> *mut block2::DynBlock<
dyn Fn(
NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
NonNull<ProtocolObject<dyn GCRelativeInput>>,
c_float,
),
>;
#[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
/// Setter for [`deltaDidChangeHandler`][Self::deltaDidChangeHandler].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setDeltaDidChangeHandler:))]
#[unsafe(method_family = none)]
unsafe fn setDeltaDidChangeHandler(
&self,
delta_did_change_handler: Option<
&block2::DynBlock<
dyn Fn(
NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
NonNull<ProtocolObject<dyn GCRelativeInput>>,
c_float,
),
>,
>,
);
/// The last reported delta for the input.
#[unsafe(method(delta))]
#[unsafe(method_family = none)]
unsafe fn delta(&self) -> c_float;
/// Check if the input can support more than just digital values.
///
/// Defaults to
/// `YES`for most relative inputs.
#[unsafe(method(isAnalog))]
#[unsafe(method_family = none)]
unsafe fn isAnalog(&self) -> bool;
/// The timestamp of the last change.
///
/// This time interval is not relative to any specific point in time. You can
/// subtract a previous timestamp from the current timestamp to determine the time
/// (in seconds) between changes to the value.
#[unsafe(method(lastDeltaTimestamp))]
#[unsafe(method_family = none)]
unsafe fn lastDeltaTimestamp(&self) -> NSTimeInterval;
/// The interval (in seconds) between the timestamp of the last change and the
/// current time.
///
/// This should be treated as a lower bound of the event latency. It may not
/// include (wired or wireless) transmission latency, or latency accrued on
/// the device before the event was transmitted to the host.
#[unsafe(method(lastDeltaLatency))]
#[unsafe(method_family = none)]
unsafe fn lastDeltaLatency(&self) -> NSTimeInterval;
#[cfg(feature = "GCPhysicalInputSource")]
/// An object describing the physical action(s) the user performs to manipulate
/// this input.
#[unsafe(method(sources))]
#[unsafe(method_family = none)]
unsafe fn sources(&self) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>;
}
);