feat(nds): improve key input system
This commit is contained in:
17
app/utils/input.ts
Normal file
17
app/utils/input.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user