nothings/stb
stb single-file public domain libraries for C/C++
📚 One Header, Many Uses: The stb Libraries
A curated set of single-file, public-domain C/C++ libraries covering graphics, audio, math, and utility tasks.
stb is a GitHub project by Sean Barrett (nothings) offering 21 lightweight, self-contained libraries for C/C++. Each library lives in a single file, making integration trivial — just drop the file into your project and define the implementation macro when needed. It covers image loading/decoding, audio decoding (Ogg Vorbis), font rasterization, dynamic arrays, snprintf, text editing, and even voxel rendering.
✨ Highlights
- Image loading:
stb_image.hsupports JPG, PNG, TGA, BMP, PSD, GIF, HDR, and PIC formats. - Image writing:
stb_image_write.hwrites PNG, TGA, and BMP files to disk. - Image resizing:
stb_image_resize2.hresizes images with high-quality filtering. - Font rasterization:
stb_truetype.hparses and renders TrueType fonts. - Typesafe containers:
stb_ds.hprovides dynamic arrays and hash tables for C/C++. - Fast formatting:
stb_sprintf.hoffers a fast, robust implementation of sprintf/snprintf. - Audio decoding:
stb_vorbis.cdecodes Ogg Vorbis files from memory or file input. - Text editing:
stb_textedit.hprovides core text editing functionality for custom UIs.
💡 Why it matters
stb libraries are designed for simplicity and portability. They require no external dependencies and compile cleanly across platforms. Their single-file nature makes them ideal for embedding in games, tools, or any project where minimizing build complexity is key. While not optimized for every edge case, they provide solid, readable implementations that are easy to audit and modify.
Notably, the project carries a security advisory: bugs may be discussed publicly before fixes are merged, so evaluate risk accordingly.
#C #GameDev #Graphics #OpenSource #TiniX