Struct sdl2::controller::GameController [] [src]

pub struct GameController {
    // some fields omitted
}

Wrapper around the SDL_GameController object

Methods

impl GameController
[src]

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

Attempt to open the controller number id and return it. Controller IDs are the same as joystick IDs and the maximum number can be retreived using the SDL_NumJoysticks function.

fn name(&self) -> String

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

fn mapping(&self) -> String

Return a String describing the controller's button and axis mappings

fn get_attached(&self) -> bool

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

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

Get the position of the given axis

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

Return Ok(true) if button is pressed.

Trait Implementations

impl Drop for GameController
[src]

fn drop(&mut self)

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