Key
ceramic.Key (Class)
Represents a keyboard key press event with both key code and scan code information.
Key provides two ways to identify a keyboard key:
- KeyCode: Layout-dependent (changes with QWERTY, AZERTY, etc.)
- ScanCode: Layout-independent (physical key position)
This dual representation allows games to support both:
- Localized controls (using key codes that match printed key labels)
- Position-based controls (using scan codes for consistent physical positions)
Instance Members
keyCode: KeyCodeKey code (localized key) depends on keyboard mapping (QWERTY, AZERTY, ...)
keyCodeName: StringName associated to the key code (localized key)
scanCode: ScanCodeScan code (US international key) doesn't depend on keyboard mapping (QWERTY, AZERTY, ...)
scanCodeName: StringName associated to the scan code (US international key)
Creates a new Key instance with the specified key code and scan code.
| Name | Type | Description |
|---|---|---|
keyCode |
KeyCode | The layout-dependent key code |
scanCode |
ScanCode | The layout-independent scan code |
Private Members
toString(): StringReturns a string representation of this key. Format: "Key(keyCode keyCodeName / scanCode scanCodeName)"
| Returns | Description |
|---|---|
| String | String representation of the key |
Metadata
| Name | Parameters |
|---|---|
:structInit |
- |