pub unsafe trait GCAxisInput: NSObjectProtocol {
// Provided methods
unsafe fn valueDidChangeHandler(
&self,
) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCAxisInput>>, c_float)>
where Self: Sized + Message { ... }
unsafe fn setValueDidChangeHandler(
&self,
value_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCAxisInput>>, c_float)>>,
)
where Self: Sized + Message { ... }
unsafe fn value(&self) -> c_float
where Self: Sized + Message { ... }
unsafe fn isAnalog(&self) -> bool
where Self: Sized + Message { ... }
unsafe fn canWrap(&self) -> bool
where Self: Sized + Message { ... }
unsafe fn lastValueTimestamp(&self) -> NSTimeInterval
where Self: Sized + Message { ... }
unsafe fn lastValueLatency(&self) -> NSTimeInterval
where Self: Sized + Message { ... }
unsafe fn sources(
&self,
) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
where Self: Sized + Message { ... }
}GCAxisInput only.Expand description
An object conforming to
GCAxisInputrepresents an input that produces
normalized values - between [-1, 1] - along an axis with a fixed origin.
The origin - a value of 0 - corresponds the neutral state of the input.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn valueDidChangeHandler(
&self,
) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCAxisInput>>, c_float)>
Available on crate features GCPhysicalInputElement and block2 only.
unsafe fn valueDidChangeHandler( &self, ) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCAxisInput>>, c_float)>
GCPhysicalInputElement and block2 only.Set this block to be notified when the value of the axis input changes.
Parameter element: the element that has been modified.
Parameter input: the input that has been modified.
Parameter value: the value the axis was set to at the time the valueChangedHandler fired.
§Safety
- The returned block’s argument 1 must be a valid pointer.
- The returned block’s argument 2 must be a valid pointer.
Sourceunsafe fn setValueDidChangeHandler(
&self,
value_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCAxisInput>>, c_float)>>,
)
Available on crate features GCPhysicalInputElement and block2 only.
unsafe fn setValueDidChangeHandler( &self, value_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCAxisInput>>, c_float)>>, )
GCPhysicalInputElement and block2 only.Setter for valueDidChangeHandler.
This is copied when set.
Sourceunsafe fn value(&self) -> c_float
unsafe fn value(&self) -> c_float
A normalized value for the axis input, between -1 and 1 (inclusive). The values are deadzoned and saturated before they are returned so there is no value outside the range. Deadzoning does not remove values from the range, the full 0 to 1 magnitude of values are possible from the input.
As an axis is often used in a digital sense, you can rely on a value of 0 meaning the axis is inside the deadzone. Any value greater than or less than zero is not in the deadzone.
Sourceunsafe fn isAnalog(&self) -> bool
unsafe fn isAnalog(&self) -> bool
Check if the axis can support more than just digital values.
Defaults to
YESfor most axis inputs.
Sourceunsafe fn canWrap(&self) -> bool
unsafe fn canWrap(&self) -> bool
Check if the axis input value “rolls over” when reaching either the extreme high or low value. For example, some dials can be rotated past the position that represents their maximum value causing the reported value to roll over.
Defaults to
NOfor most axis elements.
Sourceunsafe fn lastValueTimestamp(&self) -> NSTimeInterval
unsafe fn lastValueTimestamp(&self) -> NSTimeInterval
The timestamp of the last value.
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.
Sourceunsafe fn lastValueLatency(&self) -> NSTimeInterval
unsafe fn lastValueLatency(&self) -> NSTimeInterval
The interval (in seconds) between the timestamp of the last event 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.
Sourceunsafe fn sources(
&self,
) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
Available on crate feature GCPhysicalInputSource only.
unsafe fn sources( &self, ) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
GCPhysicalInputSource only.An object describing the physical action(s) the user performs to manipulate this input.