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: KeyCode
Key code (localized key) depends on keyboard mapping (QWERTY, AZERTY, ...)
keyCodeName: String
Name associated to the key code (localized key)
scanCode: ScanCode
Scan code (US international key) doesn't depend on keyboard mapping (QWERTY, AZERTY, ...)
scanCodeName: String
Name 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(): String
Returns a string representation of this key. Format: "Key(keyCode keyCodeName / scanCode scanCodeName)"
Returns | Description |
---|---|
String | String representation of the key |
Metadata
Name | Parameters |
---|---|
:structInit |
- |