Struct sdl2::joystick::Joystick [] [src]

pub struct Joystick {
    // some fields omitted
}

Wrapper around the SDL_Joystick object

Methods

impl Joystick
[src]

fn subsystem(&self) -> &JoystickSubsystem

fn name(&self) -> String

Return the name of the joystick or an empty string if no name is found.

fn attached(&self) -> bool

Return true if the joystick has been opened and currently connected.

fn instance_id(&self) -> i32

fn guid(&self) -> Guid

Retreive the joystick's GUID

fn num_axes(&self) -> u32

Retreive the number of axes for this joystick

fn axis(&self, axis: u32) -> SdlResult<i16>

Gets the position of the given axis.

The function will fail if the joystick doesn't have the provided axis.

fn num_buttons(&self) -> u32

Retreive the number of buttons for this joystick

fn button(&self, button: u32) -> SdlResult<bool>

Return Ok(true) if button is pressed.

The function will fail if the joystick doesn't have the provided button.

fn num_balls(&self) -> u32

Retreive the number of balls for this joystick

fn ball(&self, ball: u32) -> SdlResult<(i32, i32)>

Return a pair (dx, dy) containing the difference in axis position since the last poll

fn num_hats(&self) -> u32

Retreive the number of balls for this joystick

fn hat(&self, hat: u32) -> SdlResult<HatState>

Return the position of hat for this joystick

Trait Implementations

impl Drop for Joystick
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more