Text labels, buttons, and input fields are the foundational interactive elements of any LWXGL interface. Labels render a static or dynamic string using the global X11 font. Buttons provide clickable regions with three distinct visual states. Input fields capture keyboard entry when the mouse cursor is inside them, storing up to 128 characters that can be retrieved at any time withDocumentation 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.
GetInput.
All element IDs are application-defined integers. An ID must be unique across all element types — it serves as the index into LWXGL’s internal element slot array.
CreateText
text at position (x, y) using the current global font (9x15 or 9x15bold). The string pointer is stored directly — it is not copied — so the memory it points to must remain valid for the entire lifetime of the element.
Unique element ID. If a slot at this index already holds an element, behavior is undefined.
X coordinate of the text baseline origin in pixels, relative to the window’s top-left corner.
Y coordinate of the text baseline origin in pixels.
Null-terminated string to display. The pointer must remain valid until
DeleteElement(id) is called. To use a temporary or stack-allocated string, use CreateCopiedText instead.Palette index (0–15) or
CLR_* constant for the text foreground color.CreateCopiedText
CreateText, except that text is duplicated internally with strdup. The caller can free or reuse the original pointer immediately after this call returns. The duplicated copy is freed automatically when DeleteElement(id) is called.
Unique element ID.
X coordinate of the text baseline origin in pixels.
Y coordinate of the text baseline origin in pixels.
Null-terminated string to display. The string is copied; the original pointer can be freed after this call.
Palette index (0–15) or
CLR_* constant for the text foreground color.CreateButton
onclick callback is invoked on a left mouse button release while the cursor is inside the button bounds.
Unique element ID.
X coordinate of the button’s top-left corner in pixels.
Y coordinate of the button’s top-left corner in pixels.
Width of the button in pixels.
Height of the button in pixels.
Unpressed (idle) background color — palette index (0–15) or
CLR_* constant.Hover background color — shown when the mouse cursor is inside the button but no button is held.
Pressed background color — shown while the left mouse button is held down inside the button.
Null-terminated label string rendered centered in the button. The pointer is stored directly (not copied) and must remain valid for the element’s lifetime.
Function called when the button is clicked. Pass
NULL for a non-interactive button (visual-only).CreateInput
Unique element ID.
X coordinate of the input field’s top-left corner in pixels.
Y coordinate of the input field’s top-left corner in pixels.
Width of the input field in pixels. Pass
-1 to auto-compute the width as (max + 1) * 9 + 10 pixels, which is exactly wide enough to display max characters in the 9x15 font with padding.Height of the input field in pixels.
Inactive (unfocused) background color — palette index (0–15) or
CLR_* constant.Active/hover background color — shown when the cursor is inside the field.
Maximum number of characters the field will accept. Clamped internally to 127 regardless of the value passed. The internal buffer is always 128 bytes (127 characters + null terminator).
GetInput
'\0'). The pointer remains valid until DeleteElement(id) is called.
ID of an existing input element created with
CreateInput.