taylorplewe/zdraw
Simple drawing program with native and web frontends
Simple drawing program written in Zig
This was born out of an interest to re-write my entry into a work competition from C to Zig.
| button | action |
|---|---|
| left click | draw black |
| right click | draw white |
| wheel up | increase pencil size |
| wheel down | decrease pencil size |
| ctrl + z | undo |
| ctrl + shift + z | redo |
| q | (on native app) quit |
The project consists of a backend, which contains all the actual drawing code and is written in Zig, and two different frontends: a native SDL one, which is written in Zig but calls SDL C functions, and a WebAssembly one.
You can see the WebAssembly one live at https://tplewe.com/zdraw.
You have the option to build one or both of the frontends.
Requirements:
SDL3-devel-3.2.18-VC)zig build -Dnative
By default, it searches for your SDL3 lib and include directories in your %LIB% and %INCLUDE% environment variables, respectively. If you wish to manually provide the paths to these directories, build with
zig build -Dnative -Dinclude-path="path/to/sdl3/include" -Dlib-path="path/to/sdl3/lib"
Requirements:
zig build -Dwasm
This will also run tsc, transpiling any TypeScript files to JavaScript.
To build both frontends, simply run
zig build
With any of the above build commands, append -Doptimize=ReleaseSmall for an optimized release build.