pub struct SignedAxis(/* private fields */);
Expand description
An unsigned axis, representing a centered value, such as a joystick axis.
Implementations§
Source§impl SignedAxis
impl SignedAxis
pub fn from_raw(val: u8) -> Self
pub fn raw(&self) -> u8
Sourcepub fn float(&self) -> f32
pub fn float(&self) -> f32
Return axis as an f32 in the range of [-1.0, 1.0]
Note: the gamecube doesn’t have a true center point. To have the controller properly
centered, use SignedAxis::float_centered
and provide a centerpoint (typically pulled
from when the controller is first registered or on recalibration).
Sourcepub fn double(&self) -> f64
pub fn double(&self) -> f64
Return axis as an f64 in the range of [-1.0, 1.0]
Note: You likely do not want the additional precision.
Sourcepub fn float_centered(&self, center: u8) -> f32
pub fn float_centered(&self, center: u8) -> f32
Return axis as an f32
in the range of [-1.0, 1.0] centered around a given raw value.
It is recommended the provided center value is pulled on start and on recalibration on a
per-axis basis as most controllers have slight variation in their center.
Sourcepub fn double_centered(&self, center: u8) -> f64
pub fn double_centered(&self, center: u8) -> f64
Return axis as an f64
in the range of [-1.0, 1.0] centered around a given raw value.
It is recommended the provided center value is pulled on start and on recalibration on a
per-axis basis as most controllers have slight variation in their center.