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

pub struct Joystick {
    // some fields omitted
}

Wrapper around the SDL_Joystick object

Methods

impl Joystick
[src]

fn open(id: i32) -> SdlResult<Joystick>

Attempt to open the joystick at number id and return it.

fn name(&self) -> String

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

fn get_attached(&self) -> bool

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

fn get_instance_id(&self) -> SdlResult<i32>

fn get_guid(&self) -> SdlResult<Guid>

Retreive the joystick's GUID

fn get_num_axis(&self) -> SdlResult<i32>

Retreive the number of axes for this joystick

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

Get the position of the given axis

fn get_num_buttons(&self) -> SdlResult<i32>

Retreive the number of buttons for this joystick

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

Return Ok(true) if button is pressed.

fn get_num_balls(&self) -> SdlResult<i32>

Retreive the number of balls for this joystick

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

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

fn get_num_hats(&self) -> SdlResult<i32>

Retreive the number of balls for this joystick

fn get_hat(&self, hat: i32) -> 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