Rectangle and ellipse elements are the simplest persistent drawing primitives in LWXGL. Each is defined by a bounding box and a pair of colors: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.
fg controls the border (outline) and bg controls the fill. Setting either to CLR_NONE (-1) skips that draw operation entirely, allowing filled shapes without borders, outlined shapes without fills, or both.
Both types can be repositioned and resized at any time using ElemModifyBounds.
Color Semantics
| Parameter | Role | Renders via |
|---|---|---|
fg | Border / outline | XDrawRectangle / XDrawArc |
bg | Fill | XFillRectangle / XFillArc |
CLR_NONE (-1) for either parameter to suppress that draw call. Both CLR_NONE is legal but produces an invisible element.
Functions
CreateRect
Creates a persistent rectangle element. On each frame, LWXGL first fills the interior (ifbg is not CLR_NONE) and then draws the one-pixel border (if fg is not CLR_NONE).
Unique integer identifier for this element.
Left edge of the rectangle in pixels.
Top edge of the rectangle in pixels.
Width of the rectangle in pixels.
Height of the rectangle in pixels.
Border color, one of the
CLR_* constants. Pass CLR_NONE for no border.Fill color, one of the
CLR_* constants. Pass CLR_NONE for no fill (transparent).CreateEllipse
Creates a persistent ellipse (or circle) element inscribed within the given bounding box. The full 360° arc is drawn usingXFillArc and XDrawArc.
Unique integer identifier for this element.
Left edge of the bounding box in pixels.
Top edge of the bounding box in pixels.
Width of the bounding box in pixels. Set equal to
h for a perfect circle.Height of the bounding box in pixels.
Outline color, one of the
CLR_* constants. Pass CLR_NONE for no outline.Fill color, one of the
CLR_* constants. Pass CLR_NONE for no fill.ElemModifyBounds
Repositions or resizes any element, including rectangles and ellipses. Pass-1 for w or h to leave the corresponding dimension unchanged.
The identifier of the element to modify.
New x position (left edge).
New y position (top edge).
New width, or
-1 to keep the current width.New height, or
-1 to keep the current height.