#include #include using namespace ncpp; typedef union Grapheme { uint8_t utf8[4]; uint32_t to_uint32 = 0; } Grapheme; inline uint32_t utf32_to_egc(const uint32_t character) { Grapheme result; if (!notcurses_ucs32_to_utf8(&character, 1, result.utf8, 4)) { std::cerr << "Couldn't convert ucs32 " + std::to_string(character) + "to utf8!" << std::endl; return EXIT_FAILURE; }; return result.to_uint32; } int run () { NotCurses nc; Plane* nc_plane = nc.get_stdplane(); Cell corner_ul = Cell(utf32_to_egc(L'┌')); Cell corner_ur = Cell(utf32_to_egc(L'┐')); Cell corner_bl = Cell(utf32_to_egc(L'└')); Cell corner_br = Cell(utf32_to_egc(L'┘')); Cell horizontal_line = Cell(utf32_to_egc(L'─')); Cell vertical_line = Cell(utf32_to_egc(L'│')); nc_plane->perimeter( corner_ul, corner_ur, corner_bl, corner_br, horizontal_line, vertical_line, 0 ); nc_plane->putstr(0, 1, "channel"); nc_plane->putstr(1, 1, "─"); /*nc_plane->cursor_move(0, 0); Cell start; nc_plane->get_at(0, 0, start); //nc_plane->get_at(0, 0, &end); nc_plane->vline( start, 10 );*/ while (true) { nc.render(); sleep(1); } return 0; } int main () { if (!setlocale (LC_ALL, "")){ std::cerr << "Couldn't set locale based on user preferences" << std::endl; return EXIT_FAILURE; } try { return run (); } catch (ncpp::init_error &e) { std::cerr << "Initialization error: " << e.what () << std::endl; } catch (ncpp::invalid_state_error &e) { std::cerr << "Invalid state error: " << e.what () << std::endl; } catch (ncpp::invalid_argument &e) { std::cerr << "Invalid argument error: " << e.what () << std::endl; } return 1; }