termbox2 2.5.0

termbox2 2.5.0

On December 28, after more than two years, the release of version 2.5.0 of the library for creating TUI took place. termbox2, written in C and distributed under the MIT license.

Compared to the original termbox, it retains a simple API and has no dependencies other than libc, but adds:

  • more stringent error checking;
  • more efficient parsing of escape sequences;
  • optional 32-bit color support;
  • improved Unicode grapheme support;
  • generation of code for embedded escape sequences;
  • a test suite;
  • and much more.

The library is organized as a single-file library (the .h file is only 128K), although it can also be compiled as a separate dynamic or static library.

#define TB_IMPL #include "termbox2.h" 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; }

Source: linux.org.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster