From 8c2c4f0b256b31da6e12759b29b612514726e35e Mon Sep 17 00:00:00 2001 From: waltem01 Date: Sun, 7 Aug 2022 19:25:00 +0200 Subject: [PATCH] commented gamepad.ts file --- Webserver/src/lib/client/gamepad.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Webserver/src/lib/client/gamepad.ts b/Webserver/src/lib/client/gamepad.ts index dc3540f..e51e4f2 100644 --- a/Webserver/src/lib/client/gamepad.ts +++ b/Webserver/src/lib/client/gamepad.ts @@ -1,8 +1,10 @@ +// Interface to represent coordinates on the matrix export interface Coordinates { x: number; y: number; } +// Try detecting connected gamepad export function detectGamepad() { const gps = navigator.getGamepads(); if (gps.length === 0) return null; @@ -10,6 +12,7 @@ export function detectGamepad() { return gps[0]; } +// Try detecting gamepad button presses export function gamepadButtonPress(gamepad: Gamepad | null, gameCoords: Coordinates) { if (!gamepad) return;