[][src]Struct beryllium::Controller

#[repr(transparent)]
pub struct Controller<'sdl> { /* fields omitted */ }

Handle to a window on the screen.

Methods

impl<'sdl> Controller<'sdl>[src]

pub fn mapping_string(&self) -> Option<String>[src]

Obtains the mapping string, if available.

pub fn name(&self) -> Option<String>[src]

The implementation defined name for this controller.

pub fn is_attached(&self) -> bool[src]

Checks that the controller is currently connected.

pub fn axis(&self, axis: ControllerAxis) -> i16[src]

Gives the axis value of the specified axis.

  • Sticks: negative to positive
  • Triggers: zero to positive

Also gives 0 on failure. You could call get_error if you want.

pub fn button(&self, button: ControllerButton) -> bool[src]

Gives if the given button is pressed.

Note that this returns false for not-pressed but also if there's some sort of error. You can call get_error if you really want.

pub fn joystick_id(&self) -> Result<JoystickID, String>[src]

Attempts to get the joystick ID of this controller.

Trait Implementations

impl<'sdl> Drop for Controller<'sdl>[src]

impl<'sdl> Debug for Controller<'sdl>[src]

Auto Trait Implementations

impl<'sdl> !Send for Controller<'sdl>

impl<'sdl> Unpin for Controller<'sdl>

impl<'sdl> !Sync for Controller<'sdl>

impl<'sdl> UnwindSafe for Controller<'sdl>

impl<'sdl> RefUnwindSafe for Controller<'sdl>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]