tui.h (562B)
1 #ifndef TUI_H 2 #define TUI_H 3 4 #include <unistd.h> 5 6 #define type(str) write(1, str, sizeof(str)) 7 8 #define STR_(x) #x 9 #define STR(x) STR_(x) 10 11 #define esc "\x1b" 12 #define csi esc "[" 13 14 #define switch_to csi "?1049" 15 #define main_buffer "h" 16 #define alternate_buffer "l" 17 18 #define clear_buffer csi "2J" 19 #define clear_line csi "2K" 20 #define clear_to_end_of_line csi "0K" 21 22 #define hide_cursor csi "?25l" 23 #define show_cursor csi "?25h" 24 #define set_cursor(n, m) csi STR(n) ";" STR(m) "H" 25 26 void initialize_terminal(); 27 void type_line(const char* msg, unsigned int line); 28 29 #endif