Struct gilrs::GamepadState
[−]
[src]
pub struct GamepadState { pub right_stick: (f32, f32), pub left_stick: (f32, f32), pub z: (f32, f32), pub btn_left_thumb: bool, pub btn_right_thumb: bool, pub right_trigger: f32, pub right_trigger2: f32, pub left_trigger: f32, pub left_trigger2: f32, pub btn_south: bool, pub btn_east: bool, pub btn_north: bool, pub btn_west: bool, pub btn_c: bool, pub btn_z: bool, pub btn_select: bool, pub btn_start: bool, pub btn_mode: bool, pub btn_dpad_down: bool, pub btn_dpad_left: bool, pub btn_dpad_up: bool, pub btn_dpad_right: bool, }
Cached state of gamepad's buttons and axes.
Fields
right_stick: (f32, f32)
left_stick: (f32, f32)
z: (f32, f32)
btn_left_thumb: bool
btn_right_thumb: bool
right_trigger: f32
right_trigger2: f32
left_trigger: f32
left_trigger2: f32
btn_south: bool
btn_east: bool
btn_north: bool
btn_west: bool
btn_c: bool
btn_z: bool
btn_select: bool
btn_start: bool
btn_mode: bool
btn_dpad_down: bool
btn_dpad_left: bool
btn_dpad_up: bool
btn_dpad_right: bool
Methods
impl GamepadState
[src]
fn new() -> Self
Creates new GamepadState
with all values zeroed.
fn set_btn(&mut self, btn: Button, val: bool)
Sets new value for given button.
fn set_axis(&mut self, axis: Axis, val: f32)
Sets new value for given axis.
fn is_pressed(&self, btn: Button) -> bool
Examines cached gamepad state to check if given button is pressed. If btn
can also be
represented by axis returns true if value is not equal to 0.0. Always returns false
for
Button::Unknown
.
fn value(&self, axis: Axis) -> f32
Examines cached gamepad state to check axis's value. If axis
is represented by button on
device it value is 0.0 if button is not pressed or 1.0 if is pressed. Returns NaN
for
Axis::Unknown
.
Trait Implementations
impl Copy for GamepadState
[src]
impl Clone for GamepadState
[src]
fn clone(&self) -> GamepadState
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for GamepadState
[src]
impl Default for GamepadState
[src]
fn default() -> GamepadState
Returns the "default value" for a type. Read more
impl PartialEq for GamepadState
[src]
fn eq(&self, __arg_0: &GamepadState) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &GamepadState) -> bool
This method tests for !=
.