C99 Framework for game development https://banjo.codework-orange.com
  • C 97.8%
  • CMake 1.6%
  • Objective-C 0.6%
Find a file
Kevin d'Orange 698e14c3b1
All checks were successful
C++ Compatibility / C++ Compatibility Check (push) Successful in 18s
Documentation / build-docs (push) Successful in 16s
QA / cert (push) Successful in 38s
Build and Test / linux-linux-gcc / shared (push) Successful in 1m3s
Build and Test / linux-linux-gcc / static (push) Successful in 1m2s
Build and Test / linux-windows-mingw (build only) / shared (push) Successful in 56s
Build and Test / linux-windows-mingw (build only) / static (push) Successful in 57s
chore(test): opt-in leak check in tests (!210)
Reviewed-on: #210
2026-11-17 23:27:26 +01:00
.forgejo/workflows chore/fix-release-ci (!206) 2026-11-16 14:30:26 +01:00
assets/bmp Remove cmake build files 2025-09-15 08:35:40 +02:00
backlog chore(backlog): small feature ID fixes (#204) 2026-11-15 23:48:42 +01:00
cmake build/explicit-shared-library (#183) 2026-10-06 13:30:05 +02:00
design chore: Move specs and adrs (!209) 2026-11-16 23:14:20 +01:00
docs chore: Move specs and adrs (!209) 2026-11-16 23:14:20 +01:00
examples feat(cli): handle extra arguments back to the program (!207) 2026-11-16 22:14:38 +01:00
inc/banjo feat(cli): handle extra arguments back to the program (!207) 2026-11-16 22:14:38 +01:00
specifications chore: Move specs and adrs (!209) 2026-11-16 23:14:20 +01:00
src feat(cli): handle extra arguments back to the program (!207) 2026-11-16 22:14:38 +01:00
test chore(test): opt-in leak check in tests (!210) 2026-11-17 23:27:26 +01:00
.gitattributes chore: Move specs and adrs (!209) 2026-11-16 23:14:20 +01:00
.gitignore Big pass on API symbol namings for readability purpose (#181) 2026-09-02 22:33:05 +02:00
ACKNOWLEDGEMENTS.md Refactor API naming convention for consistency 2026-05-31 17:54:56 +02:00
BUILDING.md chore(test): opt-in leak check in tests (!210) 2026-11-17 23:27:26 +01:00
CHANGELOG.md feat(cli): handle extra arguments back to the program (!207) 2026-11-16 22:14:38 +01:00
CMakeLists.txt feat(stream): create the text wrapper API 2026-11-14 21:39:13 +01:00
CMakePresets.json Wayland Support (#106) 2026-05-30 15:40:44 +02:00
CONTRIBUTING.md chore: Move specs and adrs (!209) 2026-11-16 23:14:20 +01:00
INTEGRATING.md chore/bump-version-1.2 (#205) 2026-11-16 10:17:24 +01:00
LICENSE.md Provide SHA and SBOM in releases (#132) 2026-06-02 14:46:55 +02:00
README.md feat(stream): create the text wrapper API 2026-11-14 21:39:13 +01:00

Banjo

A small, low-level game framework in C99, built against the firm and repeated advice of people who knew better.

License: MIT Language: C99 Dependencies: system libraries only Platforms: Linux, Windows, macOS, Web

Simple · Minimal · Self-documented · Fast

There is a piece of advice, wise and shouted across the internet over and over, that goes: write games, not engines. Banjo heard it, agreed with every word, thanked everyone warmly for their concern, and went off to build the engine. It is small, written in plain C99, and turns up with the parts of a game already bolted on: a window, a framebuffer to draw on, sound, input, networking, math, and physics. You link one library and run it.

It is shaped by the games built with it, taken in roughly the order the world first made them, from the early 1970s onward, each one wanting something the one before did fine without. Banjo is the young library running along behind, trying to keep up.

What's in the box

Area What it does
Application Runs the loop for you: setup once, a step every frame at the rate you ask for, a fixed step for the physics if you want one, and teardown at the end, even in a browser tab that insists on running the loop itself.
Windowing & input Opens a window, in whatever size and shape you like, and tells you everything the keyboard and mouse get up to behind your back, by callback or by polling, whichever keeps you calmer.
2D drawing & bitmaps A framebuffer you paint by hand, one careful pixel at a time: lines, shapes, circles, polylines, BMP loading, pixel formats from 1-bit indexed to 32-bit, blitting with stretch, color-key and masks, rectangles to clip it all against, a built-in font, and per-pixel shaders for the days you feel you have something to prove.
Grids & mazes Walks that name every pixel a line or circle touches and every cell a ray crosses, corners included, and mazes carved one step at a time by six classic algorithms, or by one of your own, so you can watch them being dug.
Audio Real-time sound built from your own samples, with sine, square, triangle, and sawtooth waves thrown in, the four noises behind every beep, bloop, and truly regrettable jingle ever made.
Networking TCP and UDP over IPv4 and IPv6, with broadcast, timeouts, keep-alive, and non-blocking I/O, so two programs can hold a conversation across a network and, when the mood takes them, even listen.
Math Pick-your-precision real numbers, vectors in 2D, 3D, and 4D, matrices, and quaternions with slerp, for turning things through space smoothly and without once having to look the math in the eye.
Physics 1D motion, 2D particles with gravity and drag, 2D rigid bodies with torque, and collision tests: everything you need to make an object fall over and really mean it.
Utilities Subsystems you start and stop as you need them, shared libraries loaded at runtime, seedable PCG32 randomness with distributions, timers and stopwatches, data streams that read and write files, memory, sockets or sources of your own through one API, with bounded spans and byte-order readers, command-line parsing, logging, error handling, and replaceable allocators: the small, quiet parts that hold up the loud, ungrateful ones.
Text UTF-8 strings carried in two types: a borrowed view that measures nothing, and an owning string that validates its bytes once and replaces every ill-formed sequence with U+FFFD. The codec reads one character per call, reports failures instead of hiding them, and answers whether bytes are valid UTF-8 before they are ever built into anything. Text streams over any byte stream: a wrapper that locks its stream, reads and writes lines or chunks with the buffering and the multi-byte seams handled once, and hands the stream back where the text ended.

Each subsystem lives in its own header under inc/banjo/, where the same thing is explained again at greater length, and with a much straighter face, in the API reference.

Why Banjo

  • Simple. Plain C99 and a small, flat API. If you can read C, you can read the whole of Banjo, every last function of it, in one afternoon, with time left over for tea and a little quiet smugness.
  • Minimal. No third-party dependencies, the test suite included. Nothing to download, nothing to bundle, and nothing hiding in a corner waiting to break the moment you look away.
  • Self-documented. Every function and type is explained right where it is declared, on the simple grounds that documentation kept anywhere else drifts out of date, stops returning the code's calls, and a release or two later is happily describing a library that no longer exists.
  • Fast. It compiles in moments and starts at once, and behaves the same wherever it happens to wake up: a laptop, a build server, or a browser tab.

Examples

There are numerous self-contained programs in examples. Six are proper tutorials, best taken in order, since each one quietly assumes you made it out of the last one alive:

  1. \ref start.c - open a window, draw something, react to ESC.
  2. \ref event_callbacks.c - keyboard, mouse, and cursor.
  3. \ref drawing_2d.c - every 2D primitive.
  4. \ref load_bmp.c - load and blit a BMP.
  5. \ref audio_pcm.c - make a noise, entirely on purpose.
  6. \ref pong.c - a complete two-player Pong, the oldest game still able to end a friendship.

The rest are short single-API demos across windowing, drawing, sprites, physics, timing, randomness, and networking.

Continuous integration

On every push, Banjo is set upon by a small, tireless team of machines that have never once found any of this boring:

  • Linux builds, static and shared, each one built, tested, and measured for coverage, and Windows builds, cross-compiled, which the machines think nothing of, though for now only built.
  • The CERT C secure-coding rules enforced by clang-tidy, with every warning promoted on the spot to the rank of error.
  • The documentation rebuilt from scratch, so it can never quietly drift out of step with the code while the code isn't looking.
  • Releases that package themselves into Linux and Windows binaries and a full copy of the API reference, asking no human to so much as stand up.

Platforms

Linux, Windows, and macOS, and the web too, through WebAssembly, for anyone determined to run a game inside the one program already holding forty browser tabs hostage.

Documentation

Where the real explaining is kept: API reference · BUILDING · INTEGRATING · CONTRIBUTING · CHANGELOG · ACKNOWLEDGEMENTS

License

MIT, set out in full in LICENSE: short, permissive, and completely relaxed about the whole thing. Do nearly anything you like with it; just don't stand up in public and claim you wrote it.