Skip to main content

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.

LWXGL (Lightweight X11 Graphics Library) provides a minimal C API for creating windowed X11 applications on Linux. Build GUIs with built-in widgets, draw to indexed-color canvases, handle keyboard and mouse events, and drive a fixed-rate render loop — all from a single shared library with no heavy dependencies beyond Xlib.

Installation

Build and install the shared library on your Linux system in minutes.

Quickstart

Create your first LWXGL window with a button and event loop.

Core Concepts

Understand the window lifecycle, color palette, element system, and event model.

API Reference

Complete reference for every function exported by LWXGL.

What LWXGL Provides

LWXGL wraps Xlib into a straightforward C API that covers everything needed for a typical GUI tool or simple game:

UI Elements

Text labels, buttons, text inputs, checkboxes, rectangles, and scrollable consoles — all managed by integer IDs.

Image Canvases

Pixel-addressable canvases backed by the 16-color palette. Draw rectangles, circles, lines, sprites, and custom bitmap text.

TGA Image Loading

Load indexed-color TGA files, optionally importing their palette, and render them onto image canvases.

Event Handling

Attach callbacks for key presses, mouse clicks, window deletion, and resize. Query mouse and keyboard state directly.

Getting Started

1

Build and install the library

Clone the repository, run make build, then sudo make install to copy libLWXGL.so and libLWXGL.h to your system.
2

Include the header and link the library

Add #include <libLWXGL.h> to your source file and compile with -lLWXGL (plus -lX11 when compiling the library itself).
3

Create a window and enter the loop

Call GCreateWindow, add your elements, then call GSimpleWindowLoop with a target FPS and a per-frame callback.
4

Clean up on exit

Call GTerminateWindow after the loop exits to free all X11 resources.
LWXGL requires a running X11 display server. It is not compatible with Wayland-only environments unless an XWayland compatibility layer is active.

Build docs developers (and LLMs) love