[−][src]Struct stick::Device
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(&self) -> 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
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,