LWXGL is a lightweight C/C++ library that lets you open an X11 window, place interactive widgets, draw shapes and sprites, and handle keyboard and mouse events — all through a single, dependency-free header. Compile it once as a shared library, includeDocumentation 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.
libLWXGL.h, and you have a complete GUI toolkit in under 1,000 lines of code.
Installation
Build the shared library from source and install it system-wide in two commands.
Quickstart
Open a window, add a button, and run the event loop in under 30 lines of C.
Guides
Understand the window lifecycle, widget system, drawing API, and color palette.
API Reference
Full reference for every function exported by LWXGL, with parameters and return values.
How it works
LWXGL wraps Xlib into a small set of C functions. You create a window, populate it with elements (widgets and image canvases), attach event callbacks, and drive the loop yourself — or letGSimpleWindowLoop manage the frame cadence for you.
Build and install the library
Clone the repository and run
make && make install to build libLWXGL.so and copy it to /usr/local/lib.Include the header
Add
#include <libLWXGL.h> to your source file. The header exposes the full public API and is compatible with both C and C++.Create a window
Call
GCreateWindow(width, height, "Title", bgColor) to open an X11 window with a fixed size and a background from the 16-color palette.Key features
UI Widgets
Text labels, buttons with hover/press states, text inputs, and rectangles — all managed by an integer element ID.
Image Canvas
Create pixel buffers, write palette indices directly, and push them to the screen with
GUpdateImage.Drawing Primitives
Draw rectangles, circles, lines, and RLE-encoded sprites into any image canvas element.
Event System
Attach callbacks for keypresses, mouse clicks, and window close. Query mouse position and key state at any time.
16-Color Palette
A fixed CGA-inspired palette covering black through white. Use palette indices everywhere — no hex colors needed.
Simple Loop
GSimpleWindowLoop caps your frame rate, calls your per-frame callback, and tracks FPS — no manual timing required.