diff options
author | Adrian Kummerlaender | 2016-12-11 13:39:58 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2016-12-11 13:39:58 +0100 |
commit | 0ab22bf684f4b30f1182eed6901bd3764e428ec7 (patch) | |
tree | 6dc38375a726b53ae16dbcabf8dd11d6cde53fc8 /src/util | |
parent | 6622e436442e37190c43aa40770f0f01bc2427e9 (diff) | |
download | termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.tar termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.tar.gz termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.tar.bz2 termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.tar.lz termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.tar.xz termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.tar.zst termlife-0ab22bf684f4b30f1182eed6901bd3764e428ec7.zip |
Extract terminal functions
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/term.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/util/term.cc b/src/util/term.cc new file mode 100644 index 0000000..9e4c101 --- /dev/null +++ b/src/util/term.cc @@ -0,0 +1,30 @@ +#include "term.h" + +#include <termbox.h> + +namespace util { + +void print_tb( + std::size_t x, + std::size_t y, + std::uint16_t fg, + std::uint16_t bg, + const std::string& text +) { + for ( const char& c : text ) { + tb_change_cell(x, y, c, fg, bg); + x++; + } +} + +TermGuard::TermGuard() { + tb_init(); + tb_select_output_mode(TB_OUTPUT_NORMAL); + tb_select_input_mode(TB_INPUT_ESC | TB_INPUT_MOUSE); +} + +TermGuard::~TermGuard() { + tb_shutdown(); +} + +} |