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§

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.

Returns true if an indicated “fire” button is being pressed, otherwise returns false.

Changes the stick direction using provided flags.

Returns the current stick direction.

Provided Methods§

Changes the stick direction using an enum.

Resets a joystick to a central (neutral) position.

Returns true if a joystick is in the up (forward) position.

Returns true if a joystick is in the right position.

Returns true if a joystick is in the left position.

Returns true if a joystick is in the down (backward) position.

Returns true if a joystick is in the center (neutral) position.

Implementors§