The LWXGL console element is a scrollable text display widget with a built-in scroll bar. It renders text in a monospaced grid using the window’s X11 font (9×15 pixels per character). The console accumulates output into an internalDocumentation 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.
std::string buffer, word-wraps lines that exceed the configured column width, and displays the visible window of lines offset by the current scroll position.
Functions
GCreateConsole
x, y). The pixel dimensions are derived automatically from the column and row counts:
- Width:
cols * 9 + 17pixels (9 px per character + 8 px right margin for the scrollbar) - Height:
rows * 15 + 10pixels (15 px per row + 10 px vertical padding)
0.
Element slot to create the console at.
X position of the console’s top-left corner in the window (pixels).
Y position of the console’s top-left corner in the window (pixels).
Number of character columns in the visible area. Also controls the line-wrap width: lines longer than
cols characters are automatically wrapped.Number of visible character rows. Determines how many lines are shown at once and how large the scroll thumb is relative to the total content.
Packed color byte for the console background and border (upper nibble = border palette index, lower nibble = fill palette index). The scrollbar thumb is drawn with the border color.
Packed color byte for text rendering. The upper nibble is used as the palette index for normal output text. The lower nibble is used as the foreground color for the scroll status overlay text (
XDrawImageString) shown when the cursor hovers over the console.GConsolePrint
id. The format string and variadic arguments follow the same conventions as the standard printf family — all standard format specifiers (%d, %s, %f, %.2f, etc.) are supported.
Special characters are handled as follows:
\n— inserts a newline, starting a new logical line.\t— expands to four spaces during rendering (stored as a literal tab in the buffer, expanded when drawn).- Any character outside the printable ASCII range 27–126 (except
\nand\t) is rendered as?.
GConsolePrint calls.
The console element to append output to.
printf-style format string.Variadic arguments matching the format string specifiers.
GConsoleClear
0, and the scroll position is reset to 0 (top). The console will render as empty on the next GRenderWindow call.
The console element to clear.
Scrolling Behavior
The console supports interactive scrolling while the mouse cursor is inside its bounding box:| Interaction | Effect |
|---|---|
| Scroll wheel up | Scroll up by 3 lines |
| Scroll wheel down | Scroll down by 3 lines |
| Spacebar (while hovering) | Jump instantly to the bottom (latest output) |
Scroll Status Overlay
When the cursor is inside the console, two status strings are rendered in the top-right corner of the widget usingXDrawImageString (opaque background, so they do not blend into the text beneath):
X— first visible line number (1-based)Y— last visible line number (X + rows - 1)Z— total number of wrapped visual lines in the bufferN— scroll percentage (scroll / max(1, total_lines - rows) * 100)
txt_clr (foreground) drawn on the lower nibble of con_clr (background).
Scrollbar
A vertical scrollbar thumb is drawn in the right margin (5 px wide, 8 px from the right edge of the widget). Its height is proportional torows / total_lines, with a minimum height of 16 px. Its vertical position reflects the current scroll offset within the scrollable range.