pub struct InputAxisValue(/* private fields */);Expand description
A finite normalized value for one float input axis.
The raw Input API describes this representation only as a float. The game
consumes bindable axes in the inclusive -1.0..=1.0 interval, where zero is
the center and the endpoints are the two maximum directions. Real ETS2
validation showed that a value below -1.0 still crosses the ABI boundary
successfully but is interpreted by the input UI as the neutral center.
Keeping the normalized domain in this type prevents safe plugins from
emitting those semantically invalid values.
Construction rejects NaN and infinities as well as finite out-of-range values. Values are never silently clamped because that would hide a device conversion error and would not match the observed game behavior.
Implementations§
Source§impl InputAxisValue
impl InputAxisValue
Sourcepub const MIN: InputAxisValue
pub const MIN: InputAxisValue
Maximum movement in the negative direction.
Sourcepub const CENTER: InputAxisValue
pub const CENTER: InputAxisValue
Neutral centered position.
Sourcepub const MAX: InputAxisValue
pub const MAX: InputAxisValue
Maximum movement in the positive direction.
Sourcepub fn new(value: f32) -> Result<InputAxisValue, InputAxisValueError>
pub fn new(value: f32) -> Result<InputAxisValue, InputAxisValueError>
Validates one normalized axis value.
Both positive and negative zero are accepted and preserved exactly.
§Errors
Returns InputAxisValueError::NotFinite for NaN or either infinity,
and InputAxisValueError::OutOfRange for a finite value outside the
inclusive -1.0..=1.0 interval.
Trait Implementations§
Source§impl Clone for InputAxisValue
impl Clone for InputAxisValue
Source§fn clone(&self) -> InputAxisValue
fn clone(&self) -> InputAxisValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more