Text labels and rectangles are the simplest LWXGL elements — they display static content and can be repositioned or hidden at runtime. Both are non-interactive by default, thoughDocumentation 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.
GElemInside can be used to test whether the mouse cursor is hovering over them.
GCreateText
\n characters. Each line is 16 px tall (15 px glyph + 1 px leading).
Element slot index. If the slot is already occupied, the existing element is deleted first.
Left edge of the text in window pixels.
Top edge of the first line in window pixels. The baseline of the first line is drawn at
y + 11.Palette index (0–15) for the text color.
Null-terminated string to display.
\n characters create additional lines. The pointer is stored directly — do not free or move the string while the element exists.Because the text pointer is stored by reference, string literals and static buffers are safe. Heap-allocated strings must remain valid for the lifetime of the element.
GCreateRect
Element slot index.
Left edge in window pixels.
Top edge in window pixels.
Width in pixels.
Height in pixels.
Border color as a palette index (0–15). Pass
-1 to draw no border.Fill color as a palette index (0–15). Pass
-1 for a transparent (no fill) rectangle, leaving the background visible inside the border.The border is drawn with
XDrawRectangle, which insets the right and bottom edges by 1 px, so the effective outer size is w × h and the stroke falls inside that area.GDeleteElement
id and sets the slot to NULL. All internal memory for the element (including any XImage data for image elements) is released.
Element slot index to delete. Safe to call when the slot is already
NULL or when id is out of the current element vector range — both cases are silently ignored.GElemModifyBounds
id at runtime. The change takes effect on the next GRenderWindow call. Works for all element types.
Element slot index.
New left edge in window pixels.
New top edge in window pixels.
New width in pixels. For text elements this value is stored but not used by the renderer; pass
0 if not applicable.New height in pixels. Same note as
w for text elements.GElemSetVisible
id. Hidden elements are skipped entirely during rendering and do not receive mouse-event processing.
Element slot index.
1 — show the element (default state after creation). 0 — hide the element.GElemInside
1 if the current mouse cursor position falls within the element’s bounding box, 0 otherwise. The element must also be visible (GElemSetVisible(..., 1)) to return 1.
For checkbox elements the bounding box is extended to include the label text: the right edge is widened by 6 + label_char_count * 9 pixels.
Element slot index.
int — 1 if the cursor is inside, 0 if not.