feat(nds): improve key input system

This commit is contained in:
2026-02-10 16:28:54 +01:00
parent 38b36d0e1c
commit a95feb223e
16 changed files with 59 additions and 102 deletions

17
app/utils/input.ts Normal file
View File

@@ -0,0 +1,17 @@
const KEY_TO_NDS_BUTTON: Record<string, string> = {
ArrowUp: "UP",
ArrowDown: "DOWN",
ArrowLeft: "LEFT",
ArrowRight: "RIGHT",
D: "A",
S: "B",
Z: "X",
Q: "Y",
" ": "SELECT",
Enter: "START",
};
export const mapKeyToNDS = (key: string): string | null => {
key = key.length === 1 ? key.toUpperCase() : key;
return KEY_TO_NDS_BUTTON[key] ?? null;
};