Skip to content

ryupold/examples-raylib.zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raylib.zig examples

This is a collection of examples using the Zig raylib bindings of raylib.zig

supported platforms

  • Windows
  • macOS
  • Linux
  • HTML5/WebGL (emscripten)

examples

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.

BUILD

dependencies

git clone --recurse-submodules https://github.com/ryupold/examples-raylib.zig

run locally

zig build run # runs first example (hello_world)
zig build run -Dexample=5 # runs example no. 5

build for host os and architecture

zig build -Doptimize=ReleaseSmall
zig build -Doptimize=ReleaseSmall -Dexample=6 # build example no. 6

The output files will be in ./zig-out/bin

html5 / emscripten

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

About

Example usage of raylib.zig bindings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •