gitmyhub

nuklear

C ★ 14k updated 6y ago ▣ archived

A single-header ANSI C gui library

Nuklear is a minimal single-header C library for building immediate-mode GUIs, buttons, sliders, and windows, that outputs a list of shapes for your app to draw, with no rendering or platform code included. Note: this repo is unmaintained, active development is at the community fork.

Csetup: hardcomplexity 4/5

Nuklear is a small toolkit for building graphical user interfaces, the buttons, sliders, checkboxes, and windows that people click on inside a program. It is written in a long-standing version of the C programming language. The first thing the README says is that this particular copy of the project is no longer maintained: all development has moved to a different repository run by the Nuklear community, and activity here is ignored. Anyone planning to use it should go there instead.

The library takes a deliberately narrow approach. It does not open windows on your screen, talk to the operating system, or draw anything by itself. Instead it reads simple information about the user's input, such as mouse and keyboard state, and produces a list of basic shapes to draw. Your own program is responsible for showing those shapes using whatever graphics system it already has. This style is known as immediate mode, where the interface is rebuilt every frame rather than kept as a stored set of objects. The README highlights that it has no outside dependencies, can run without even the standard C library if you prefer, keeps memory use low, supports UTF-8 text, and can be fully restyled.

It is distributed as a single header file, a common pattern in C where the whole library lives in one file you include in your code. By default that include only brings in the declarations. To get the actual working code you define a specific flag in exactly one of your source files before including it, and the README warns that mismatched settings between includes can cause serious errors.

The README shows a short example that creates a window with a button, some option toggles, and a volume slider. It also lists community-made bindings that let you use Nuklear from other languages, including Java, Rust, Go, Python, and Lua. The software is offered under two choices: the MIT license or the public domain.

Where it fits