Trait GCLinearInput

Source
pub unsafe trait GCLinearInput: NSObjectProtocol {
    // Provided methods
    unsafe fn valueDidChangeHandler(
        &self,
    ) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCLinearInput>>, 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 GCLinearInput>>, 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 { ... }
}
Available on crate feature GCLinearInput only.
Expand description

An object conforming to GCLinearInputrepresents an input that produces normalized values in the unit interval - between [0, 1].

See also Apple’s documentation

Provided Methods§

Source

unsafe fn valueDidChangeHandler( &self, ) -> *mut DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCLinearInput>>, c_float)>
where Self: Sized + Message,

Available on crate features GCPhysicalInputElement and block2 only.

Set this block to be notified when the value of the 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 valueDidChangeHandler fired.

Source

unsafe fn setValueDidChangeHandler( &self, value_did_change_handler: Option<&DynBlock<dyn Fn(NonNull<ProtocolObject<dyn GCPhysicalInputElement>>, NonNull<ProtocolObject<dyn GCLinearInput>>, c_float)>>, )
where Self: Sized + Message,

Available on crate features GCPhysicalInputElement and block2 only.
Source

unsafe fn value(&self) -> c_float
where Self: Sized + Message,

A normalized value for the axis input, between 0 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.

You can rely on a value of 0 meaning the value is inside the deadzone. Any value greater than zero is not in the deadzone.

Source

unsafe fn isAnalog(&self) -> bool
where Self: Sized + Message,

Check if the input can support more than just digital values.

If YES,the input can produce any value between [0, 1]. Otherwise, the input only produces the values 0 or 1.

Source

unsafe fn canWrap(&self) -> bool
where Self: Sized + Message,

Check if the 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 next reported value to roll over.

Defaults to NO for most inputs.

Source

unsafe fn lastValueTimestamp(&self) -> NSTimeInterval
where Self: Sized + Message,

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.

Source

unsafe fn lastValueLatency(&self) -> NSTimeInterval
where Self: Sized + Message,

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.

Source

unsafe fn sources( &self, ) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>
where Self: Sized + Message,

Available on crate feature GCPhysicalInputSource only.

An object describing the physical action(s) the user performs to manipulate this input.

Trait Implementations§

Source§

impl ProtocolType for dyn GCLinearInput

Source§

const NAME: &'static str = "GCLinearInput"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn GCLinearInput
where T: ?Sized + Message + GCLinearInput,

Implementations on Foreign Types§

Source§

impl<T> GCLinearInput for ProtocolObject<T>
where T: ?Sized + GCLinearInput,

Implementors§