[][src]Struct stick::Device

#[repr(C)]
pub struct Device { /* fields omitted */ }

The state of a joystick, gamepad or controller device.

Methods

impl Device[src]

pub fn joy(&self) -> Option<(f32, f32)>[src]

Get main joystick state from the device if a main joystick exists, otherwise return None.

pub fn cam(&mut self) -> Option<(f32, f32)>[src]

Get X & Y from camera stick if it exists, otherwise return None.

pub fn dir(&mut self) -> Option<(f32, f32)>[src]

Get X & Y facing direction from camera stick. This is like cam() for x, but pitch() for y.

pub fn pitch(&mut self) -> Option<f32>[src]

Get the pitch throttle value. Returns None if the pitch throttle doesn't exist.

pub fn btn<B: Into<u8>>(&self, b: B) -> Option<bool>[src]

Return Some(true) if a button is pressed, Some(false) if not, and None if the button doesn't exist.

pub fn mod_swap_btn<B: Into<u8> + Copy + Clone>(&mut self, a: B, b: B)[src]

Swap 2 buttons in the mapping.

Panics

Panics if the controller doesn't support either button a or button b.

pub fn mod_swap_joy(&mut self)[src]

Swap X & Y on joy stick

pub fn mod_l2pitch(&mut self)[src]

Copy l value to pitch.

pub fn mod_t2lr(&mut self)[src]

If trigger is all of the way down, activate button.

pub fn mod_expand(&mut self)[src]

mod_expand( axis for old controllers like GameCube.

Trait Implementations

impl Copy for Device[src]

impl Default for Device[src]

impl Clone for Device[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Display for Device[src]

impl Debug for Device[src]

Auto Trait Implementations

impl Send for Device

impl Sync for Device

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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]