Every LWXGL frame follows a fixed pipeline: clear the back-buffer, render elements or run your callback (depending on rendering order), then flip to screen. These functions let you control that order, schedule work to run after a delay, and draw shapes or text directly from within your callback without creating persistent elements.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.
Constants
ORDER_* — Rendering Order
| Constant | Value | Meaning |
|---|---|---|
ORDER_ELEM_SECOND | 0 | (Default) The on_every callback fires first; elements are drawn on top of anything you draw in the callback. |
ORDER_ELEM_FIRST | 1 | Elements are drawn first; the on_every callback fires after, so callback drawing appears on top of elements. |
Functions
SetRenderingOrder
Controls whether registered elements are drawn before or after theon_every callback in each frame. The default is ORDER_ELEM_SECOND, meaning elements appear on top.
Either
ORDER_ELEM_FIRST (1) or ORDER_ELEM_SECOND (0).Call
SetRenderingOrder before MainWindowLoop starts. Changing it mid-loop takes effect from the very next frame.NewQueuedTask
Schedules a zero-argument function to be called after a specified number of seconds of elapsed loop time. Tasks are checked and dispatched once per frame, at the end of the frame in which their deadline is reached.Number of seconds to wait before the task fires, measured from the moment
NewQueuedTask is called (i.e., relative to the current GetElapsedTime() value).Function to call when the delay elapses. The task runs once and is then removed from the queue.
GetElapsedTime
Returns the total elapsed time in seconds sinceMainWindowLoop began. The value is accumulated from the delta_time of each processed frame, so it reflects real wall-clock time minus any time spent waiting between frames.
float in seconds. The value is 0.0 before MainWindowLoop is entered.
Immediate Drawing Functions
These functions draw directly to the back-buffer during the current frame and produce no persistent element. They are designed to be called from inside theon_every callback. Anything drawn here is cleared at the start of the next frame.
ImmediateText
Draws a string at the given position using the current font (9x15 or 9x15bold). Newline characters (\n) are supported; each subsequent line is offset by 15 pixels vertically. The y coordinate is shifted down by 11 pixels internally to align the font baseline.
Left edge of the text in pixels, relative to the window origin.
Top edge of the text. The actual baseline is drawn at
y + 11; subsequent lines step by 15 pixels each.Null-terminated string to draw. Newline characters split the string into multiple lines.
Text color, one of the
CLR_* palette constants.ImmediateRect
Draws a filled and/or outlined rectangle. Eitherfg or bg can be CLR_NONE to skip the corresponding draw call.
Left edge of the rectangle in pixels.
Top edge of the rectangle in pixels.
Width in pixels.
Height in pixels.
Border color (
CLR_*), or CLR_NONE to draw no border.Fill color (
CLR_*), or CLR_NONE to draw no fill (transparent interior).ImmediateEllipse
Draws a filled and/or outlined ellipse inscribed in the given bounding box. Eitherfg or bg can be CLR_NONE.
Left edge of the bounding box in pixels.
Top edge of the bounding box in pixels.
Width of the bounding box in pixels.
Height of the bounding box in pixels.
Outline color (
CLR_*), or CLR_NONE for no outline.Fill color (
CLR_*), or CLR_NONE for no fill.ImmediateLine
Draws a straight line segment between two points usingXDrawLine.
X coordinate of the start point.
Y coordinate of the start point.
X coordinate of the end point.
Y coordinate of the end point.
Line color, one of the
CLR_* palette constants.