Struct sdl2::joystick::Joystick
[−]
[src]
pub struct Joystick { /* fields omitted */ }
Wrapper around the SDL_Joystick object
Methods
impl Joystick
[src]
pub fn subsystem(&self) -> &JoystickSubsystem
[src]
pub fn name(&self) -> String
[src]
Return the name of the joystick or an empty string if no name is found.
pub fn attached(&self) -> bool
[src]
Return true if the joystick has been opened and currently connected.
pub fn instance_id(&self) -> i32
[src]
pub fn guid(&self) -> Guid
[src]
Retreive the joystick's GUID
pub fn num_axes(&self) -> u32
[src]
Retreive the number of axes for this joystick
pub fn axis(&self, axis: u32) -> Result<i16, IntegerOrSdlError>
[src]
Gets the position of the given axis
.
The function will fail if the joystick doesn't have the provided axis.
[src]
Retreive the number of buttons for this joystick
[src]
Return Ok(true)
if button
is pressed.
The function will fail if the joystick doesn't have the provided button.
pub fn num_balls(&self) -> u32
[src]
Retreive the number of balls for this joystick
pub fn ball(&self, ball: u32) -> Result<(i32, i32), IntegerOrSdlError>
[src]
Return a pair (dx, dy)
containing the difference in axis
position since the last poll
pub fn num_hats(&self) -> u32
[src]
Retreive the number of balls for this joystick
pub fn hat(&self, hat: u32) -> Result<HatState, IntegerOrSdlError>
[src]
Return the position of hat
for this joystick