Skip to content

taylorplewe/zdraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zdraw

Simple drawing program written in Zig

image

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.

Build instructions

You have the option to build one or both of the frontends.

Native (SDL3)

Requirements:

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"

WebAssembly

Requirements:

  • Zig 0.14.x
  • TypeScript
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.

About

Simple drawing program with native and web frontends

Topics

Resources

License

Stars

Watchers

Forks