objc2_game_controller/generated/GCLinearInput.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 /// `GCLinearInput`represents an input that produces
13 /// normalized values in the unit interval - between [0, 1].
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gclinearinput?language=objc)
16 pub unsafe trait GCLinearInput: NSObjectProtocol {
17 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
18 /// Set this block to be notified when the value of the input changes.
19 ///
20 ///
21 /// Parameter `element`: the element that has been modified.
22 ///
23 /// Parameter `input`: the input that has been modified.
24 ///
25 /// Parameter `value`: the value the axis was set to at the time the valueDidChangeHandler fired.
26 #[unsafe(method(valueDidChangeHandler))]
27 #[unsafe(method_family = none)]
28 unsafe fn valueDidChangeHandler(
29 &self,
30 ) -> *mut block2::DynBlock<
31 dyn Fn(
32 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
33 NonNull<ProtocolObject<dyn GCLinearInput>>,
34 c_float,
35 ),
36 >;
37
38 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
39 /// Setter for [`valueDidChangeHandler`][Self::valueDidChangeHandler].
40 #[unsafe(method(setValueDidChangeHandler:))]
41 #[unsafe(method_family = none)]
42 unsafe fn setValueDidChangeHandler(
43 &self,
44 value_did_change_handler: Option<
45 &block2::DynBlock<
46 dyn Fn(
47 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
48 NonNull<ProtocolObject<dyn GCLinearInput>>,
49 c_float,
50 ),
51 >,
52 >,
53 );
54
55 /// A normalized value for the axis input, between 0 and 1 (inclusive). The values
56 /// are deadzoned and saturated before they are returned so there is no value
57 /// outside the range. Deadzoning does not remove values from the range, the full
58 /// 0 to 1 magnitude of values are possible from the input.
59 ///
60 /// You can rely on a value of 0 meaning the value is inside the deadzone. Any
61 /// value greater than zero is not in the deadzone.
62 #[unsafe(method(value))]
63 #[unsafe(method_family = none)]
64 unsafe fn value(&self) -> c_float;
65
66 /// Check if the input can support more than just digital values.
67 ///
68 /// If
69 /// `YES,`the input can produce any value between [0, 1]. Otherwise, the
70 /// input only produces the values 0 or 1.
71 #[unsafe(method(isAnalog))]
72 #[unsafe(method_family = none)]
73 unsafe fn isAnalog(&self) -> bool;
74
75 /// Check if the input value "rolls over" when reaching either the extreme high
76 /// or low value. For example, some dials can be rotated past the position that
77 /// represents their maximum value, causing the next reported value to roll over.
78 ///
79 /// Defaults to NO for most inputs.
80 #[unsafe(method(canWrap))]
81 #[unsafe(method_family = none)]
82 unsafe fn canWrap(&self) -> bool;
83
84 /// The timestamp of the last value.
85 ///
86 /// This time interval is not relative to any specific point in time. You can
87 /// subtract a previous timestamp from the current timestamp to determine the time
88 /// (in seconds) between changes to the value.
89 #[unsafe(method(lastValueTimestamp))]
90 #[unsafe(method_family = none)]
91 unsafe fn lastValueTimestamp(&self) -> NSTimeInterval;
92
93 /// The interval (in seconds) between the timestamp of the last event and the
94 /// current time.
95 ///
96 /// This should be treated as a lower bound of the event latency. It may not
97 /// include (wired or wireless) transmission latency, or latency accrued on
98 /// the device before the event was transmitted to the host.
99 #[unsafe(method(lastValueLatency))]
100 #[unsafe(method_family = none)]
101 unsafe fn lastValueLatency(&self) -> NSTimeInterval;
102
103 #[cfg(feature = "GCPhysicalInputSource")]
104 /// An object describing the physical action(s) the user performs to manipulate
105 /// this input.
106 #[unsafe(method(sources))]
107 #[unsafe(method_family = none)]
108 unsafe fn sources(&self) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>;
109 }
110);