code / tomo-btui

Lines1.1K C700 Tomo305 Markdown95

BTUI - Bruce's Terminal User Interface

This is an extremely lightweight, but powerful Tomo library for making terminal user interfaces based on the C library BTUI.

Usage

Add this to your modules.ini:

1 [btui]
2 version=v1.1
3 git=https://github.com/bruce-hill/tomo-btui

Example program

1 use btui
3 func main()
4 set_mode(TUI)
5 size := get_size()
6 style(bold=yes)
7 write("Welcome to BTUI", size/2, Center)
8 style(bold=no, faint=yes)
9 write("Press 'q' or 'Ctrl-c' to quit", size/2 + ScreenVec2(0,1), Center)
10 style(bold=no)
11 repeat
12 key := get_key()
13 pos := size/2 + ScreenVec2(0,2)
14 clear(Line, pos=pos)
15 style(Magenta)
16 write("Your input: $key", pos, Center)
17 if key == "q" or key == "Ctrl-c"
18 stop
20 disable()

A more complex example program can be found at examples/picker.tm

License

This code is licensed under the MIT license with the Commons Clause. See LICENSE.md for full details.