@mafiahub/types 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework/key.d.ts +16 -0
- package/package.json +1 -1
package/framework/key.d.ts
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
* - Numpad `numpad0`–`numpad9` (aliases `num0`–`num9`)
|
|
18
18
|
* - Mouse `mouse1` (left) `mouse2` (right) `mouse3` (middle) `mouse4` `mouse5`
|
|
19
19
|
*
|
|
20
|
+
* Letters and digits identify physical positions on a US keyboard. Use
|
|
21
|
+
* `getLabel` to show the corresponding label in the player's current layout.
|
|
22
|
+
*
|
|
20
23
|
* @example
|
|
21
24
|
* // Toggle a HUD on key-down:
|
|
22
25
|
* Key.bind("f6", "down", () => toggleHud());
|
|
@@ -52,4 +55,17 @@ declare const Key: {
|
|
|
52
55
|
* game window is in the background (same gate as bind dispatch).
|
|
53
56
|
*/
|
|
54
57
|
isDown(key: string): boolean;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Display label for a physical key using the current keyboard layout.
|
|
61
|
+
* For example, `getLabel("y")` returns `"Z"` on German QWERTZ.
|
|
62
|
+
* Works while menus/web views own input and without registering a binding.
|
|
63
|
+
* Query again when refreshing a prompt so layout changes are reflected.
|
|
64
|
+
* Labels are display text; keep using the original key name for bindings.
|
|
65
|
+
* @returns Uppercase printable text, or an English name such as `"Enter"`
|
|
66
|
+
* or `"Mouse 1"`. Falls back to the uppercase canonical key name if the
|
|
67
|
+
* layout cannot translate it. Ignores held modifiers and Caps Lock.
|
|
68
|
+
* @throws If the key is unknown or the argument is not a string.
|
|
69
|
+
*/
|
|
70
|
+
getLabel(key: string): string;
|
|
55
71
|
};
|