Skip to content

EvilCultist/zig-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig-wasm

A sandbox for compiling Zig to WebAssembly and running it in the browser.

Features

  • Two Zig modules compiled to WebAssembly (wasm32-freestanding) — a minimal JS bridge demo and a checkerboard pixel renderer
  • Shared WebAssembly.Memory between JavaScript and Wasm modules via import_memory
  • Animated checkerboard pattern rendered on an HTML5 Canvas using putImageData
  • Native HTTP server written in Zig (using zap) to serve static files and Wasm binaries

Prerequisites

  • Zig >= 0.14.0-dev.3460 (see build.zig.zon)
  • A modern web browser with WebAssembly support

Build & Run

zig build       # builds checkerboard.wasm, root.wasm, and the server binary
zig build run   # launches the HTTP server on port 3000

Open http://localhost:3000. The page loads both Wasm modules and renders an animated checkerboard that cycles colors every 250ms.

Dependencies

  • zap v0.9.0 — HTTP server library

License

MIT

About

me trying to compile zig to wasm, maybe try raylib or opengl to render

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors