Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dundalek/notcurses-zig-example
Demo showing how to use Notcurses library for building terminal UIs with Zig
https://github.com/dundalek/notcurses-zig-example
liz notcurses terminal tui zig
Last synced: 6 days ago
JSON representation
Demo showing how to use Notcurses library for building terminal UIs with Zig
- Host: GitHub
- URL: https://github.com/dundalek/notcurses-zig-example
- Owner: dundalek
- License: unlicense
- Created: 2021-04-11T19:34:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-15T11:30:10.000Z (about 1 year ago)
- Last Synced: 2024-10-13T10:24:31.349Z (21 days ago)
- Topics: liz, notcurses, terminal, tui, zig
- Language: Zig
- Homepage:
- Size: 43.9 KB
- Stars: 61
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-zig - notcurses-zig-example🗒️Demo showing how to use Notcurses library for building terminal UIs with Zig
README
# Notcurses Zig example
[Notcurses](https://notcurses.com/) is a moderm library for building terminal UIs with advanced graphics support.
This is a demo showing how to use it with [Zig](https://ziglang.org/) programming language.
Thanks to Zig's seamless C interop the library can be used directly without wrapper bindings.![Notcurses Zig demo](https://user-images.githubusercontent.com/755611/114319180-d83ac400-9aff-11eb-8b50-3e9a388b91c7.png)
### Dependencies
- Install [Notcurses dependencies](https://github.com/dankamongmen/notcurses/blob/master/INSTALL.md)
- using [Nix](https://nixos.org/):
`nix-shell`
- for Debian/Ubuntu:
`sudo apt-get install build-essential cmake libncurses-dev libreadline-dev libunistring-dev libqrcodegen-dev zlib1g-dev`
- [Install Zig](https://ziglang.org/download/) (version 0.11.0)
- Get Notcurses to compile from sources (since distributions don't often package latest versions):
```sh
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:
```sh
zig build run
```Or build and run the binary separately:
```sh
zig build
./zig-cache/run/demo
```### Liz source
The source of this demo is actually written in [Liz](https://github.com/dundalek/liz), which is Zig dialect with [lispy syntax](https://en.m.wikipedia.org/wiki/S-expression) that transpiles down to Zig code. If you feel adventurous to explore land of parentheses you can [download Liz](https://github.com/dundalek/liz/releases/latest) and compile sources with:
```sh
liz src/*.liz && zig build
```### Related
See also the demo implemented in [Clojure](https://github.com/dundalek/notcurses-clojure-example).