Struct rich_sdl2_rust::event::joystick::Joystick
source · pub struct Joystick { /* private fields */ }
Expand description
A physical joystick device manages its states, input devices and power levels.
Implementations§
source§impl Joystick
impl Joystick
sourcepub fn from_id(id: JoystickId<'_>) -> Option<Self>
pub fn from_id(id: JoystickId<'_>) -> Option<Self>
Constructs from JoystickId
if it is valid.
sourcepub fn instance_id(&self) -> JoystickId<'_>
pub fn instance_id(&self) -> JoystickId<'_>
Returns the instance id JoystickId
.
sourcepub fn power_level(&self) -> PowerLevel
pub fn power_level(&self) -> PowerLevel
Returns the power level of the joystick.
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether the joystick is enabled.
sourcepub fn axis(&self, index: InputIndex) -> Option<Axis<'_>>
pub fn axis(&self, index: InputIndex) -> Option<Axis<'_>>
Returns an axis of index
if it exists.
sourcepub fn trackballs(&self) -> Trackballs<'_>
pub fn trackballs(&self) -> Trackballs<'_>
Returns trackballs Trackballs
that the joystick has.
sourcepub fn trackball(&self, index: InputIndex) -> Option<Trackball<'_>>
pub fn trackball(&self, index: InputIndex) -> Option<Trackball<'_>>
Returns a trackball of index
if it exists.
Returns buttons Buttons
that the joystick has.
Returns a button of index
if it exists.
sourcepub fn hat(&self, index: InputIndex) -> Option<Hat<'_>>
pub fn hat(&self, index: InputIndex) -> Option<Hat<'_>>
Returns a hat of index
if it exists.
Trait Implementations§
source§impl From<GameController> for Joystick
impl From<GameController> for Joystick
source§fn from(gc: GameController) -> Self
fn from(gc: GameController) -> Self
Converts to this type from the input type.