This is a collection of examples using the Zig raylib bindings of raylib.zig
- Windows
- macOS
- Linux
- HTML5/WebGL (emscripten)
During build you will be asked which example should be executed. The example code can be found in ./src/examples
.
You can test the WebGL examples here.
git clone --recurse-submodules https://github.com/ryupold/examples-raylib.zig
zig build run # runs first example (hello_world)
zig build run -Dexample=5 # runs example no. 5
zig build -Doptimize=ReleaseSmall
zig build -Doptimize=ReleaseSmall -Dexample=6 # build example no. 6
The output files will be in ./zig-out/bin
cd <emscripten directory>
./emsdk_env.ps1 # windows
./emsdk_env.sh # linux / macos
zig build -Doptimize=ReleaseSmall -Dtarget=wasm32-wasi --sysroot "<emscripten directory>/upstream/emscripten"
The output files will be in ./zig-out/web/
- game.html (entry point)
- game.js
- game.wasm
- game.data
The game data needs to be served with a webserver. Just opening the game.html in a browser won't work
You can utilize python as local http server:
python -m http.server