Immediate-mode functions draw directly to the LWXGL back-buffer pixmap rather than into a retained element. Because the back-buffer is cleared and recomposited at the start of every frame, anything drawn with an immediate function disappears before the nextDocumentation 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.
on_every invocation — there are no IDs to manage and no explicit cleanup required. Call them inside your on_every callback to produce overlays, HUDs, debug visualizations, or any other per-frame decoration that should not persist between frames. All immediate functions use palette-indexed colors consistent with the global 16-entry LWXGL palette.
ImmediateText
Draws a multi-line string directly to the back-buffer using the global X11 font (9x15 or 9x15bold).
+11 pixels before the first XDrawString call (baseline adjustment for the 9x15 bitmap font). Each newline character '\n' in str advances y by a further 15 pixels and resets the draw cursor to the original x position.
Left edge of the text in back-buffer coordinates.
Top of the first text line. The actual X11 baseline will be at
y + 11.Null-terminated string to draw. Embed
'\n' for line breaks; each line advances y by 15 pixels.Palette index (0–15) for the text foreground color.
ImmediateTextF
Printf-style wrapper around ImmediateText for formatted output.
vasprintf into a heap-allocated buffer, which is passed to ImmediateText and then freed. Note that the parameter order differs slightly from ImmediateText: color comes before fmt.
Left edge of the text in back-buffer coordinates.
Top of the first text line (same baseline offset as
ImmediateText applies).Palette index (0–15) for the text foreground color.
printf-compatible format string.Arguments matching the conversion specifiers in
fmt.ImmediateRect
Draws a rectangle outline and/or fill directly to the back-buffer via Xlib.
bg) is rendered with XFillRectangle and covers the full w × h area before the outline is drawn. The outline (fg) is rendered with XDrawRectangle using a bounding box of (w-1) × (h-1) so that the outer edge stays within the declared bounds. Pass CLR_NONE (-1) for either parameter to skip that layer.
X coordinate of the rectangle’s top-left corner.
Y coordinate of the rectangle’s top-left corner.
Width of the rectangle in pixels.
Height of the rectangle in pixels.
Palette index for the outline, or
CLR_NONE to omit.Palette index for the fill, or
CLR_NONE to omit.ImmediateEllipse
Draws an ellipse inscribed within a bounding box directly to the back-buffer.
XFillArc for the fill and XDrawArc for the outline, both spanning the full 360° arc (0 to 23040 units in X11’s 1/64-degree notation). Pass CLR_NONE for either color to omit that layer.
X coordinate of the bounding box’s top-left corner.
Y coordinate of the bounding box’s top-left corner.
Width of the bounding box (and the ellipse’s horizontal diameter).
Height of the bounding box (and the ellipse’s vertical diameter).
Palette index for the ellipse outline, or
CLR_NONE to omit.Palette index for the ellipse fill, or
CLR_NONE to omit.ImmediateLine
Draws a straight line between two back-buffer coordinates.
XDrawLine using the current GC line attributes (solid, 1px, butt caps). The line is drawn in a single Xlib round-trip.
X coordinate of the line start point.
Y coordinate of the line start point.
X coordinate of the line end point.
Y coordinate of the line end point.
Palette index (0–15) for the line color.
Code example
The snippet below shows a typical HUD drawn every frame usingImmediateTextF, ImmediateRect, and ImmediateLine.