-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtui.h
52 lines (41 loc) · 1.12 KB
/
tui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef TUI_H
#define TUI_H
#include <stdio.h>
#define VLINE "│"
#define HLINE "─"
#define TLCORNER "┌"
#define BLCORNER "└"
#define TRCORNER "┐"
#define BRCORNER "┘"
#define LTEE "├"
#define RTEE "┤"
#define BTEE "┴"
#define TTEE "┬"
#define PLUS "─"
#define RGB(t, r, g, b) "\033[38;2;" #r ";" #g ";" #b "m" t "\033[0m"
#define SET_COLOR(a) printf("\033[38;2;%d;%d;%dm", a[0], a[1], a[2])
#define RESET_VIDEO() printf("\033[0m")
#define INVERT() printf("\033[7m")
#define BOLD() printf("\033[1m")
#define SET_BG(a) printf("\033[48;2;%d;%d;%dm", a[0], a[1], a[2])
typedef struct {
unsigned width;
unsigned height;
unsigned x;
unsigned y;
unsigned has_borders;
} Window;
unsigned get_term_width();
unsigned get_term_height();
unsigned get_cursor_x_position();
unsigned get_cursor_y_position();
void inittui();
void endtui();
char getch();
void printfxy(unsigned x, unsigned y, const char * fmt, ...);
void printfxy_to_window(Window * win, int x, int y, const char * fmt, ...);
void draw_window(Window * win);
int is_echo();
void showecho(int echo);
void showcursor(int show);
#endif