From 83e9205e383091d4921c82cf6cb8f45e6f636509 Mon Sep 17 00:00:00 2001 From: Louis Poirier Date: Sat, 24 Jul 2021 01:26:10 +0200 Subject: [PATCH 1/4] Refactored code : introduce functions to switch UI between keyboard events and gamepad events. Gamepad logic : listen to gamepad events and show buttons / axes mapping. Gamepad UI : show a custom gamepad svg based on https://github.com/w3c/gamepad/commit/bcbdd921a81318203f7bd09f21b56abdbe190bff. Gamepad UX : cards and svg are responsive and reuse current theme styles. --- index.html | 56 ++++++++++-- scripts.js | 212 +++++++++++++++++++++++++++++++++++++++++-- standard_gamepad.svg | 1 + style.css | 8 +- 4 files changed, 256 insertions(+), 21 deletions(-) create mode 100644 standard_gamepad.svg diff --git a/index.html b/index.html index 20d9928..8278137 100644 --- a/index.html +++ b/index.html @@ -32,8 +32,11 @@

+

Press any key to get the JavaScript event keycode

-
+

Plug a gamepad to get the JavaScript events

+
event.key
@@ -66,6 +69,32 @@
+
+
+
gamepad.id
+
+
xinput
+
+
+
+
gamepad.mapping
+
+
standard
+
+
+
+
gamepad.buttons
+
+
+
+
+
+
gamepad.axes
+
+
+
+
+
@@ -75,18 +104,27 @@
- Made with love by - Wes Bos — fork or suggest edits on - GitHub — +