🧘Zen-C transpiles to C and builds with wasi-sdk. It is young, and a few functions have plainer signatures than elsewhere to work around a compiler bug, but simple carts are fine.
- Template: cart_zenc - press "Use this template" and you have a working game.
- Docker image:
ghcr.io/notnullgames/null0-cart-zenc:latest(linux/amd64 only - runs emulated on Apple Silicon) - Your code:
cart/main.zc, compiled with zc (transpiles to C) + wasi-sdk - Bindings:
carts/zenc/null0.h(baked into the docker image for you) - WASI is available, so ordinary file and stdio calls work.
- See carts made with Zen-C
- API docs for Zen-C
building
You do not install zc (transpiles to C) + wasi-sdk - the docker image has it, and the current null0 bindings, baked in. There is nothing in your project to keep in sync with the engine.
docker run --rm --user $(id -u):$(id -g) --platform linux/amd64 \
-v ./cart:/src -v ./webroot:/out \
ghcr.io/notnullgames/null0-cart-zenc:latest mygameThe template wraps that in npm start, which also serves the result and rebuilds when you save.
Zen-C notes
draw_polygonand its siblings take plaini32*/u8*, not structs - the compiler segfaults on a user declaration naming a C-interop struct.
a cart, in Zen-C
This is carts/zenc/simple/main.zc in the engine repo - the same file CI builds into the cart below, so it always compiles.
include "null0.h"
export fn load() {
clear(BLUE);
draw_circle(100, 100, 50, RED);
draw_text(FONT_DEFAULT, "hello from Zen-C", 170, 92, WHITE);
}
// callbacks (optional - implement as needed)
//
// export fn update() {}
carts/zenc/simple/main.zccallbacks
A cart implements the callbacks it cares about. In Zen-C they look like this:
void update() {}See anatomy of a cart for the full list and what each one is passed.