This guide walks you through everything you need to get a working LWXGL application on screen. By the end you will have opened a 640×480 window, displayed a text label, added a clickable button, attached a keyboard handler, and learned how to exit cleanly. No prior Xlib experience is required.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.
Install LWXGL
Clone the repository and build the shared library, then install it system-wide:
make build runs the following compiler invocation:sudo make install then places the files where the system linker can find them:You need
libx11-dev (Debian/Ubuntu) or libX11-devel (Fedora/RHEL) installed before building. See Building & Installing for the full dependency setup.Compile and link
libLWXGL.so in /usr/local/lib (added to the cache by ldconfig). No -L flag is needed after a system-wide install.Run it
Understanding LWXGL colorsLWXGL uses a 16-entry palette for all colors. Index
0 is Black and index 15 is White; indices 1–14 cover a range of standard colors. You can inspect any entry with GPaletteQuery(idx, &r, &g, &b) and override entries at runtime with GPaletteModify.Button state colors (u, hvr, p) pack two palette nibbles into a single byte:- Upper nibble — border/outline color index
- Lower nibble — fill color index
0x78 means border = palette[7], fill = palette[8]. This applies to the normal (u), hover (hvr), and pressed (p) states independently, so you can change both border and fill on hover or press.What’s Next
UI Elements
Explore every widget type — inputs, checkboxes, image canvases, consoles, primitives, and virtual screens.
Events & Input
Learn how to handle keyboard and mouse events, query live input state, use modal dialogs, and intercept the WM close request.