print_box.h (1148B)
1 void print_bw(int x, int y, uint64_t ch) { 2 tb_set_cell(x, y, ch, TB_BLACK, TB_WHITE); 3 } 4 5 void print_bl(int x, int y, uint64_t ch) { 6 tb_set_cell(x, y, ch, TB_BLACK, TB_BLACK); 7 } 8 9 void print_box_offset(int rows, int cols, int offx, int offy, int clear) { 10 int x,y; 11 print_bl(offx, offy, 0x250f); //heavy box corner down and right 12 for(x = offx + 1; x <= cols+offx; x++) 13 print_bl(x, offy, 0x2501); //heavy box horizontal line 14 print_bl(cols + offx + 1, offy, 0x2513); //heavy box corner down and left 15 for(y = offy + 1; y <= rows + offy; y++) { 16 print_bl(offx, y, 0x2503); //heavy box vertical line 17 print_bl(x, y, 0x2503); //heavy box vertical line 18 } 19 print_bl(x, y, 0x251b); //heavy box corner up and left 20 while(--x > offx) 21 print_bl(x, y, 0x2501); //heavy box horizontal line 22 print_bl(offx, y, 0x2517); //heavy box corner up and right 23 } 24 25 void print_box(int rows, int cols) { 26 print_box_offset(rows, cols, 0, 0, 1); 27 } 28 29 void print_msg(const char *fmt, ...) { 30 va_list vl; 31 va_start(vl, fmt); 32 tb_printf_inner(2, 10, TB_BLUE, TB_DEFAULT, NULL, fmt, vl); 33 va_end(vl); 34 }