Accept every gamepad button

This commit is contained in:
Neale Pickett 2020-05-21 20:32:23 -06:00
parent 38514fbc84
commit 74d296d1f3
1 changed files with 10 additions and 3 deletions

View File

@ -557,9 +557,16 @@ class Vail {
if (gp == null) { if (gp == null) {
continue continue
} }
currentButtons.key |= gp.buttons[0].pressed || gp.buttons[1].pressed for (let i in gp.buttons) {
currentButtons.dit |= gp.buttons[2].pressed || gp.buttons[4].pressed || gp.buttons[6].pressed let pressed = gp.buttons[i].pressed
currentButtons.dah |= gp.buttons[3].pressed || gp.buttons[5].pressed || gp.buttons[7].pressed if (i < 2) {
currentButtons.key |= pressed
} else if (i % 2 == 0) {
currentButtons.dit |= pressed
} else {
currentButtons.dah |= pressed
}
}
} }
if (currentButtons.key != this.gamepadButtons.key) { if (currentButtons.key != this.gamepadButtons.key) {