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) is a single shared library that wraps Xlib to give you a simple, procedural C API for building desktop GUI applications on Linux. Add a window, drop in buttons, text fields, checkboxes, image canvases, and consoles — all managed through integer element IDs and a straightforward render loop.

Quickstart

Create your first LWXGL window and run a render loop in minutes.

Build & Install

Compile libLWXGL.so from source and install the header system-wide.

UI Elements Guide

Buttons, text labels, input fields, checkboxes, rectangles, and consoles.

API Reference

Full reference for every function exported by libLWXGL.

What LWXGL Provides

LWXGL gives you everything needed to build functional X11 GUI applications without dealing with Xlib directly:

Window Management

Create, title, resize, and destroy X11 windows with a handful of calls.

UI Widgets

Buttons, text labels, input fields, checkboxes, and rectangle containers — all with hover and click states.

Image Canvases

Pixel-addressable canvases for custom 2D graphics, with primitives for rects, circles, lines, and sprites.

Event System

Attach callbacks for keyboard, mouse, window close, and resize events.

16-Color Palette

A built-in 16-color palette that can be queried and modified at runtime.

Virtual Screens

Group elements into virtual screens and switch between them dynamically.

Getting Started

1

Build and install the library

Clone the repository, compile the shared library, and install it:
git clone https://github.com/DRessedAlarm184/LWXGL.git
cd LWXGL
make build
sudo make install
2

Include the header

Add libLWXGL.h to your C or C++ source file:
#include <libLWXGL.h>
3

Create a window and run the loop

#include <libLWXGL.h>

void on_frame(int tick, float dt) {
    // your per-frame logic here
}

int main() {
    GCreateWindow(640, 480, "My Window", 0);
    GSimpleWindowLoop(60, on_frame);
    GTerminateWindow();
    return 0;
}
4

Compile and link

gcc -o myapp main.c -lLWXGL
./myapp
LWXGL requires Xlib (-lX11) at runtime. Ensure libx11-dev (or equivalent) is installed on your system before building.

Build docs developers (and LLMs) love