https://github.com/termbox/termbox2 Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} termbox / termbox2 Public * Notifications * Fork 4 * Star 45 suckless terminal rendering library License MIT license 45 stars 4 forks Star Notifications * Code * Issues 2 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code Latest commit @mitchellwrosen @adsr mitchellwrosen and adsr Clarify what 0x08-0x0f in TB_OUTPUT_256 means, a bit ... f3826ff May 3, 2022 Clarify what 0x08-0x0f in TB_OUTPUT_256 means, a bit f3826ff Git stats * 33 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows demo tests .clang-format .gitattributes LICENSE Makefile README.md codegen.sh termbox.h View code termbox2 Synopsis API How to use termbox2 Examples README.md termbox2 termbox2 is a terminal rendering library that retains the suckless spirit of the original termbox (simple API, no dependencies beyond libc) and adds some improvements (strict error checking, more efficient escape sequence parsing, code gen for built-in escape sequences, opt-in support for 32-bit color, extended grapheme clusters, test suite). termbox2 is organized as a single file header library, though it is possible to compile it as a stand-alone shared or static library. Synopsis #define TB_IMPL #include "termbox.h" #include int main(int argc, char **argv) { struct tb_event ev; int y = 0; tb_init(); tb_printf(0, y++, TB_GREEN, 0, "hello from termbox"); tb_printf(0, y++, 0, 0, "width=%d height=%d", tb_width(), tb_height()); tb_printf(0, y++, 0, 0, "press any key..."); tb_present(); tb_poll_event(&ev); y++; tb_printf(0, y++, 0, 0, "event type=%d key=%d ch=%c", ev.type, ev.key, ev.ch); tb_printf(0, y++, 0, 0, "press any key to quit..."); tb_present(); tb_poll_event(&ev); tb_shutdown(); return 0; } API The basic API should be pretty self-explanatory. Consult the header file itself for the complete API and documentation. int tb_init(); int tb_shutdown(); int tb_width(); int tb_height(); int tb_clear(); int tb_present(); int tb_set_cursor(int cx, int cy); int tb_hide_cursor(); int tb_set_cell(int x, int y, uint32_t ch, uintattr_t fg, uintattr_t bg); int tb_peek_event(struct tb_event *event, int timeout_ms); int tb_poll_event(struct tb_event *event); int tb_print(int x, int y, uintattr_t fg, uintattr_t bg, const char *str); int tb_printf(int x, int y, uintattr_t fg, uintattr_t bg, const char *fmt, ...); How to use termbox2 As mentioned above, there are two options: 1. Copy (or git submodule) termbox.h into your C project. As normal, include the header file wherever you want to use tb_* functions, but also be sure to #define TB_IMPL in exactly one of your source files. (This is a common pattern for single file header libraries.) 2. Build termbox2 as a library (either make libtermbox.so or make libtermbox.a) and link as normal. Examples * mle - flexible terminal-based text editor * ictree - like tree but interactive About suckless terminal rendering library Topics terminal tui terminfo ncurses curses termcap Resources Readme License MIT license Stars 45 stars Watchers 3 watching Forks 4 forks Releases No releases published Packages 0 No packages published Contributors 3 * @adsr adsr Adam * @git-bruh git-bruh Wolf Gupta * @mitchellwrosen mitchellwrosen Mitchell Rosen Languages * C 80.9% * PHP 10.5% * Shell 7.2% * Other 1.4% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.