diff --git a/src/engine/character.rs b/src/engine/character.rs index e562d02..a14c9cc 100644 --- a/src/engine/character.rs +++ b/src/engine/character.rs @@ -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; } diff --git a/src/engine/input.rs b/src/engine/input.rs index 6349ba5..1163092 100644 --- a/src/engine/input.rs +++ b/src/engine/input.rs @@ -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, + /// The events that have occur. events: VecDeque, } @@ -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, +}