Input elements provide single-line text entry boxes. When the mouse pointer is inside an input field it becomes “active” — a blinking cursor underscore (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DRESsedAlarm184/LWXGL/llms.txt
Use this file to discover all available pages before exploring further.
_) is appended to the displayed text, and key events are directed to that field. Pressing printable keys appends characters to an internal 128-byte buffer; Backspace removes the last character.
Like buttons, the normal and hover visual states are encoded as packed color integers (low nibble = fill color, high nibble = border color).
Keyboard Behavior
| Key | Action |
|---|---|
| Printable ASCII (codes 32–126) | Append to the buffer (up to max characters). |
| Backspace (code 8) | Remove the last character from the buffer. |
| All other keys | Ignored by the input field. |
Functions
CreateInput
Creates a single-line text input field.Unique integer identifier for this element.
Left edge of the input field in pixels.
Top edge of the input field in pixels.
Width of the field in pixels. Pass
-1 to auto-size: LWXGL computes (max + 1) * 9 + 10, which fits all max characters plus the cursor indicator with padding.Height of the field in pixels. A value of
24–28 typically provides comfortable padding around the 9x15 font.Packed color for the inactive state (pointer outside the field). Low nibble = fill, high nibble = border.
Packed color for the active/hover state (pointer inside the field). Same packing as
u.Maximum number of characters the field will accept. Values greater than 127 are silently clamped to 127 by
std::min(max, 127).The internal buffer is always 128 bytes. Even if you pass
max = 127 the 128th byte is reserved for the null terminator. You can never store more than 127 printable characters in a single input field.GetInput
Returns a pointer to the input field’s internal 128-byte character buffer. The returned pointer is valid untilDeleteElement(id) is called.
The identifier of an input element previously created with
CreateInput.char* pointing directly into the InputElement struct. The buffer is always null-terminated. Do not free() the returned pointer.