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.
|
/// An event was asked to the character.
|
||||||
fn manage_event(&mut self, event: Event) {
|
fn manage_event(&mut self, event: Event) {
|
||||||
match event {
|
match event {
|
||||||
Event::ButtonPressed(Button::Button1) => {
|
Event::ButtonPressed(Button::Button0) => {
|
||||||
self.jump();
|
self.jump();
|
||||||
self.can_jump = false;
|
self.can_jump = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::ButtonReleased(Button::Button1) => {
|
Event::ButtonReleased(Button::Button0) => {
|
||||||
self.can_jump = true;
|
self.can_jump = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,20 +35,23 @@ pub enum Button {
|
|||||||
Down,
|
Down,
|
||||||
|
|
||||||
/// The main action or validatation button.
|
/// The main action or validatation button.
|
||||||
Button1,
|
Button0,
|
||||||
|
|
||||||
/// The user asks to do the secondary action.
|
/// The user asks to do the secondary action.
|
||||||
Button2,
|
Button1,
|
||||||
|
|
||||||
/// The user asks to do the tertiary action.
|
/// The user asks to do the tertiary action.
|
||||||
Button3,
|
Button2,
|
||||||
|
|
||||||
/// The user asks to do the 4th action or cancel.
|
/// 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.
|
/// This structure holds what button are pressed or released, and stores the events.
|
||||||
pub struct InputManager {
|
pub struct InputManager {
|
||||||
|
/// All the connected gamepads.
|
||||||
|
gamepads: Vec<Gamepad>,
|
||||||
|
|
||||||
/// The events that have occur.
|
/// The events that have occur.
|
||||||
events: VecDeque<Event>,
|
events: VecDeque<Event>,
|
||||||
}
|
}
|
||||||
@ -57,7 +60,15 @@ impl InputManager {
|
|||||||
/// Creates a new input manager.
|
/// Creates a new input manager.
|
||||||
pub fn new() -> InputManager {
|
pub fn new() -> InputManager {
|
||||||
InputManager {
|
InputManager {
|
||||||
|
gamepads: vec![],
|
||||||
events: VecDeque::new(),
|
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