/notcurses-zig-example

Demo showing how to use Notcurses library for building terminal UIs with Zig

Primary LanguageZigThe UnlicenseUnlicense

Notcurses Zig example

Notcurses is a moderm library for building terminal UIs with advanced graphics support.

This is a demo showing how to use it with Zig programming language.
Thanks to Zig's seamless C interop the library can be used directly without wrapper bindings.

Notcurses Zig demo

Dependencies

  • Install Notcurses dependencies
    • using Nix:
      nix-shell
    • for Debian/Ubuntu:
      sudo apt-get install build-essential cmake libncurses-dev libreadline-dev libunistring-dev libqrcodegen-dev zlib1g-dev
  • Install Zig (version 0.11.0)
  • Get Notcurses to compile from sources (since distributions don't often package latest versions):
git clone https://github.com/dankamongmen/notcurses.git deps/notcurses
cd deps/notcurses
mkdir build && cd build
cmake -DUSE_MULTIMEDIA=none -DUSE_PANDOC=OFF ..
# We just need `cmake` to generate some headers, no need to actually `make` since rest will be handled by Zig
# In case of errors, try `git checkout v3.0.9` and re-run cmake as I tested it with this version.

Build and run

Build and run the demo:

zig build run

Or build and run the binary separately:

zig build
./zig-cache/run/demo

Liz source

The source of this demo is actually written in Liz, which is Zig dialect with lispy syntax that transpiles down to Zig code. If you feel adventurous to explore land of parentheses you can download Liz and compile sources with:

liz src/*.liz && zig build

Related

See also the demo implemented in Clojure.