Runnable example programs, from single-API demos to full tutorials.
Every program under examples/*.c appears here by name. Each one is a single, self-contained program documented in its own top-of-file comment block: the source you read is the source you compile.
Most examples are short demonstrations of one API. A handful are full tutorials with rich, step-by-step walkthroughs, meant to be read in order:
- start.c: Hello, Window. Open a window, draw shapes, react to ESC. The canonical first program.
- event_callbacks.c: input via callbacks. Register handlers for keyboard, mouse buttons, cursor motion, and enter/leave events. Shows how the App API plumbs
user_data through every callback.
- drawing_2d.c: drawing 2D primitives. Pixels, lines, polylines, triangles, rectangles, circles (filled and outlined).
- load_bmp.c: load a BMP from disk, query its size, blit it stretched to the framebuffer. Introduces the bitmap loader and blit operation.
- audio_pcm.c: procedural audio synthesis with the built-in sine/square/triangle/sawtooth waveform callback.
- pong.c: capstone. A complete two-player Pong that ties together window, input, drawing, and frame-paced timing.
The other examples
Shorter, single-API demos, grouped by subsystem:
- Windowing and input: window.c, event_polling.c
- Drawing and bitmaps: drawing_text.c, bitmap_blit.c, bitmap_blit_colorkey.c, sprite_animation.c, shaders.c, pixel_mode.c
- Physics and timing: physics_kinematics.c, physics_particle.c, interpolation.c, time.c, stopwatch.c
- Randomness: random.c, random_distribution.c
- Networking: net_tcp_client.c, net_tcp_server.c, net_tcp_nonblocking.c, net_tcp_timeout.c, net_udp_client.c, net_udp_server.c, net_udp_broadcast_send.c, net_udp_broadcast_recv.c
- System and diagnostics: banjo-info.c, logging.c, handling_errors.c, cli.c
- Starting points: template.c, template_callbacks.c