From 74d296d1f383e0773048ec64bb5756f407f0ad05 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 21 May 2020 20:32:23 -0600 Subject: [PATCH] Accept every gamepad button --- static/vail.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/static/vail.js b/static/vail.js index e937508..9c3f925 100644 --- a/static/vail.js +++ b/static/vail.js @@ -557,9 +557,16 @@ class Vail { if (gp == null) { continue } - currentButtons.key |= gp.buttons[0].pressed || gp.buttons[1].pressed - currentButtons.dit |= gp.buttons[2].pressed || gp.buttons[4].pressed || gp.buttons[6].pressed - currentButtons.dah |= gp.buttons[3].pressed || gp.buttons[5].pressed || gp.buttons[7].pressed + for (let i in gp.buttons) { + let pressed = gp.buttons[i].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) {