C++ header-only terminal user interface library.
termui-cpp is currently available for Windows with partial support for Unix (through Ncurses).
- Premade widgets
- Event handling
- Custom styling
- Colors (Windows only)
- Download the latest single header version.
- Either put the header file in a central location (with a specified path) or directly in your project tree.
#include <tui/tui.hpp>
int main() {
// Construct window with default dimensions
tui::Window window;
window.set_title("Hello, World!");
tui::Paragraph p;
p.text = "Hello, World!";
p.set_dimensions(0, 0, 25, 5);
bool quit = false;
tui::Event event;
// Add paragraph widget to the window
window.add(p);
while(!quit) {
if(window.poll_event(event)) {
if(event.type == tui::KEYDOWN) {
quit = true;
}
}
window.render();
}
window.close();
return 0;
}
Examples in /examples
are cross-platform; however, some features may be limited on unix.
Build all the examples with make build-examples
.
Testing requires Catch2.
Test with make test
. Compile the tests with make test-compile
.
The test output is written to the file /test/test_output.txt
.