Button0
This commit is contained in:
parent
bc48d72c90
commit
fe1a0537b5
@ -199,12 +199,12 @@ impl Updatable for Character {
|
||||
/// An event was asked to the character.
|
||||
fn manage_event(&mut self, event: Event) {
|
||||
match event {
|
||||
Event::ButtonPressed(Button::Button1) => {
|
||||
Event::ButtonPressed(Button::Button0) => {
|
||||
self.jump();
|
||||
self.can_jump = false;
|
||||
}
|
||||
|
||||
Event::ButtonReleased(Button::Button1) => {
|
||||
Event::ButtonReleased(Button::Button0) => {
|
||||
self.can_jump = true;
|
||||
}
|
||||
|
||||
|
@ -35,20 +35,23 @@ pub enum Button {
|
||||
Down,
|
||||
|
||||
/// The main action or validatation button.
|
||||
Button1,
|
||||
Button0,
|
||||
|
||||
/// The user asks to do the secondary action.
|
||||
Button2,
|
||||
Button1,
|
||||
|
||||
/// The user asks to do the tertiary action.
|
||||
Button3,
|
||||
Button2,
|
||||
|
||||
/// The user asks to do the 4th action or cancel.
|
||||
Button4,
|
||||
Button3,
|
||||
}
|
||||
|
||||
/// This structure holds what button are pressed or released, and stores the events.
|
||||
pub struct InputManager {
|
||||
/// All the connected gamepads.
|
||||
gamepads: Vec<Gamepad>,
|
||||
|
||||
/// The events that have occur.
|
||||
events: VecDeque<Event>,
|
||||
}
|
||||
@ -57,7 +60,15 @@ impl InputManager {
|
||||
/// Creates a new input manager.
|
||||
pub fn new() -> InputManager {
|
||||
InputManager {
|
||||
gamepads: vec![],
|
||||
events: VecDeque::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Holds the gamepad information.
|
||||
#[derive(Clone)]
|
||||
pub struct Gamepad {
|
||||
/// The inner gamepad.
|
||||
inner: web_sys::Gamepad,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user