diff --git a/termbox.h b/termbox.h index 3725fba..285c051 100644 --- a/termbox.h +++ b/termbox.h @@ -2,7 +2,7 @@ MIT License Copyright (c) 2010-2020 nsf - 2015-2021 Adam Saponara + 2015-2022 Adam Saponara Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -58,6 +58,8 @@ extern "C" { // __ffi_start +#define TB_VERSION_STR "2.0.0" + #if defined(TB_LIB_OPTS) || 0 // __tb_lib_opts // Ensure consistent compile-time options when using as a library #undef TB_OPT_TRUECOLOR @@ -541,6 +543,7 @@ const char *tb_strerror(int err); struct tb_cell *tb_cell_buffer(); int tb_has_truecolor(); int tb_has_egc(); +const char *tb_version(); #ifdef __cplusplus } @@ -1860,6 +1863,10 @@ int tb_has_egc() { #endif } +const char *tb_version() { + return TB_VERSION_STR; +} + static int tb_reset() { int ttyfd_open = global.ttyfd_open; memset(&global, 0, sizeof(global)); diff --git a/tests/test_basic/expected.ansi b/tests/test_basic/expected.ansi index d3208d2..55fdd39 100644 --- a/tests/test_basic/expected.ansi +++ b/tests/test_basic/expected.ansi @@ -1,3 +1,4 @@ +#5version=2.0.0 #5width=80 #5height=24 #5attr=TB_BOLD @@ -21,4 +22,3 @@ - diff --git a/tests/test_basic/test.php b/tests/test_basic/test.php index 5272ada..9ecb93f 100755 --- a/tests/test_basic/test.php +++ b/tests/test_basic/test.php @@ -12,6 +12,7 @@ $blue = $test->defines['TB_BLUE']; $y = 0; +$test->ffi->tb_printf(0, $y++, 0, 0, "version=%s", $test->ffi->tb_version()); $test->ffi->tb_printf(0, $y++, $red, $bg, "width=%d", $w); $test->ffi->tb_printf(0, $y++, $green, $bg, "height=%d", $h); foreach (['TB_BOLD', 'TB_UNDERLINE', 'TB_ITALIC', 'TB_REVERSE'] as $attr) {