objc2_game_controller/generated/GCRelativeInput.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11 /// An object conforming to
12 /// `GCRelativeInput`represents an input that reports
13 /// its change in position along an axis (delta) since the previous event.
14 /// Relative inputs have no fixed origin from which a coordinate syatem can be
15 /// defined.
16 ///
17 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcrelativeinput?language=objc)
18 pub unsafe trait GCRelativeInput: NSObjectProtocol {
19 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
20 /// Set this block to be notified when the delta of the input changes.
21 ///
22 ///
23 /// Parameter `delta`: The amount that the input has changed since the last time
24 /// `deltaDidChangeHandler`fired.
25 #[unsafe(method(deltaDidChangeHandler))]
26 #[unsafe(method_family = none)]
27 unsafe fn deltaDidChangeHandler(
28 &self,
29 ) -> *mut block2::DynBlock<
30 dyn Fn(
31 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
32 NonNull<ProtocolObject<dyn GCRelativeInput>>,
33 c_float,
34 ),
35 >;
36
37 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
38 /// Setter for [`deltaDidChangeHandler`][Self::deltaDidChangeHandler].
39 #[unsafe(method(setDeltaDidChangeHandler:))]
40 #[unsafe(method_family = none)]
41 unsafe fn setDeltaDidChangeHandler(
42 &self,
43 delta_did_change_handler: Option<
44 &block2::DynBlock<
45 dyn Fn(
46 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
47 NonNull<ProtocolObject<dyn GCRelativeInput>>,
48 c_float,
49 ),
50 >,
51 >,
52 );
53
54 /// The last reported delta for the input.
55 #[unsafe(method(delta))]
56 #[unsafe(method_family = none)]
57 unsafe fn delta(&self) -> c_float;
58
59 /// Check if the input can support more than just digital values.
60 ///
61 /// Defaults to
62 /// `YES`for most relative inputs.
63 #[unsafe(method(isAnalog))]
64 #[unsafe(method_family = none)]
65 unsafe fn isAnalog(&self) -> bool;
66
67 /// The timestamp of the last change.
68 ///
69 /// This time interval is not relative to any specific point in time. You can
70 /// subtract a previous timestamp from the current timestamp to determine the time
71 /// (in seconds) between changes to the value.
72 #[unsafe(method(lastDeltaTimestamp))]
73 #[unsafe(method_family = none)]
74 unsafe fn lastDeltaTimestamp(&self) -> NSTimeInterval;
75
76 /// The interval (in seconds) between the timestamp of the last change and the
77 /// current time.
78 ///
79 /// This should be treated as a lower bound of the event latency. It may not
80 /// include (wired or wireless) transmission latency, or latency accrued on
81 /// the device before the event was transmitted to the host.
82 #[unsafe(method(lastDeltaLatency))]
83 #[unsafe(method_family = none)]
84 unsafe fn lastDeltaLatency(&self) -> NSTimeInterval;
85
86 #[cfg(feature = "GCPhysicalInputSource")]
87 /// An object describing the physical action(s) the user performs to manipulate
88 /// this input.
89 #[unsafe(method(sources))]
90 #[unsafe(method_family = none)]
91 unsafe fn sources(&self) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>;
92 }
93);