joypad clear buttons fn
This commit is contained in:
parent
788afa49d4
commit
a9886a773a
|
@ -63,18 +63,7 @@ impl Joypad {
|
|||
gamepads: ConnectedGamepadsIterator,
|
||||
) -> bool {
|
||||
let old = *self;
|
||||
*self = Joypad {
|
||||
sel_action: self.sel_action,
|
||||
sel_direction: self.sel_direction,
|
||||
down: false,
|
||||
up: false,
|
||||
left: false,
|
||||
right: false,
|
||||
start: false,
|
||||
select: false,
|
||||
b: false,
|
||||
a: false,
|
||||
};
|
||||
self.clear_buttons();
|
||||
for (_, pad) in gamepads {
|
||||
self.down |= pad.is_pressed(Button::DPadDown);
|
||||
self.up |= pad.is_pressed(Button::DPadUp);
|
||||
|
@ -95,6 +84,17 @@ impl Joypad {
|
|||
self.b |= keys.contains(&Key::Semicolon);
|
||||
*self != old
|
||||
}
|
||||
|
||||
fn clear_buttons(&mut self) {
|
||||
self.down = false;
|
||||
self.up = false;
|
||||
self.left = false;
|
||||
self.right = false;
|
||||
self.start = false;
|
||||
self.select = false;
|
||||
self.a = false;
|
||||
self.b = false;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Joypad {
|
||||
|
|
Loading…
Reference in a new issue