Module: input.keys
Source: ./input/keys.reef
Overview
input/keys - the one KeyCode, shared by every toolkit
ROADMAP 8.2a. There used to be three KeyCode enums -- ui.event,
reefvision.event and gameui.input -- and the duplication pass reported them
as fifteen duplicated constructors because it compared function body TEXT:
return KeyCode_Enter() reads the same in two files that mean different
things by it. They were three different types:
ui.event Char(char) payload; None, Escape, Space reefvision.event Char with NO payload -- the codepoint lived beside it in KeyEvent.ch: int; Esc, BackTab, Insert, Unknown gameui.input no payloads at all; A..Z, 0..9 and F1..F12 as separate variants feeding a dense key_index() for array lookup
OWNER DECISION (2026-09-10): one shared KeyCode whose Char carries an int
UNICODE CODEPOINT. Reef's char is one byte, so ui's old Char(char) could
not represent a non-ASCII keypress at all -- widening it is a breaking
change in the direction of correctness. reefvision keeps the codepoints it
already decodes and retires the parallel KeyEvent.ch field.
gameui.input keeps its own enum and is NOT ported: it exists to be INDEXED, not matched, and one variant per letter is that design rather than a copy of this one. It shares Modifiers from here and nothing else.
Types
KeyCode (enum)
Variants:
NoneUnknownEscapeEnterTabBackTabBackspaceDeleteInsertLeftRightUpDownHomeEndPageUpPageDownSpaceChar(int)F1F2F3F4F5F6F7F8F9F10F11F12
Modifiers
Fields:
| Name | Type |
|---|---|
shift |
bool |
ctrl |
bool |
alt |
bool |
meta |
bool |
Functions
fn key_none(): KeyCode
fn key_unknown(): KeyCode
fn key_escape(): KeyCode
fn key_enter(): KeyCode
fn key_tab(): KeyCode
fn key_backtab(): KeyCode
fn key_backspace(): KeyCode
fn key_delete(): KeyCode
fn key_insert(): KeyCode
fn key_arrow_left(): KeyCode
fn key_arrow_right(): KeyCode
fn key_arrow_up(): KeyCode
fn key_arrow_down(): KeyCode
fn key_home(): KeyCode
fn key_end(): KeyCode
fn key_page_up(): KeyCode
fn key_page_down(): KeyCode
fn key_space(): KeyCode
fn key_char(codepoint: int): KeyCode
fn key_f(n: int): KeyCode
fn is_char(k: KeyCode): bool
fn key_codepoint(k: KeyCode): option.Option[int]
fn key_codepoint_or(k: KeyCode, fallback: int): int
fn keycode_eq(a: KeyCode, b: KeyCode): bool
fn keycode_index(k: KeyCode): int
fn modifiers(shift: bool, ctrl: bool, alt: bool, meta: bool): Modifiers
fn modifiers_none(): Modifiers
Generated by reefc doc