pub trait JoystickInterface {
fn fire(&mut self, btn: u8, pressed: bool);
fn get_fire(&self, btn: u8) -> bool;
fn set_directions(&mut self, dir: Directions);
fn get_directions(&self) -> Directions;
fn direction(&mut self, dir: JoyDirection) { ... }
fn center(&mut self) { ... }
fn is_up(&self) -> bool { ... }
fn is_right(&self) -> bool { ... }
fn is_left(&self) -> bool { ... }
fn is_down(&self) -> bool { ... }
fn is_center(&self) -> bool { ... }
}
Expand description
An interface for providing user input data for a JoystickDevice implementation.
Required Methods§
sourcefn fire(&mut self, btn: u8, pressed: bool)
fn fire(&mut self, btn: u8, pressed: bool)
Press or release a “fire” button. btn
is the button number for cases when the joystick have more
than one button.
Currently, btn
is not being used by any of the implemented devices.
sourcefn get_fire(&self, btn: u8) -> bool
fn get_fire(&self, btn: u8) -> bool
Returns true
if an indicated “fire” button is being pressed, otherwise returns false
.
sourcefn set_directions(&mut self, dir: Directions)
fn set_directions(&mut self, dir: Directions)
Changes the stick direction using provided flags.
sourcefn get_directions(&self) -> Directions
fn get_directions(&self) -> Directions
Returns the current stick direction.
Provided Methods§
sourcefn direction(&mut self, dir: JoyDirection)
fn direction(&mut self, dir: JoyDirection)
Changes the stick direction using an enum.