4 static int fgcol, bgcol;
6 static int cur_x, cur_y;
8 static int curses_color(int col);
18 fgcol = curses_color(TGFX_WHITE);
19 bgcol = curses_color(TGFX_BLACK);
22 tg_color(fgcol | (bgcol << 4));
42 void tg_fgcolor(int col)
44 fgcol = curses_color(col);
45 init_pair(1, fgcol, bgcol);
48 void tg_bgcolor(int col)
50 bgcol = curses_color(col);
51 init_pair(1, fgcol, bgcol);
54 void tg_color(int col)
56 fgcol = curses_color(col & 0xf);
57 bgcol = curses_color((col >> 4) & 0xf);
58 init_pair(1, fgcol, bgcol);
67 void tg_setcursor(int x, int y)
75 void tg_text(int x, int y, const char *fmt, ...)
80 tg_vtext(x, y, fmt, ap);
84 void tg_vtext(int x, int y, const char *fmt, va_list ap)
86 attron(COLOR_PAIR(1));
88 vw_printw(stdscr, fmt, ap);
89 attroff(COLOR_PAIR(1));
93 void tg_rect(const char *label, int x, int y, int xsz, int ysz, unsigned int flags)
97 attron(COLOR_PAIR(1));
99 for(i=0; i<ysz; i++) {
104 if(flags & TGFX_FRAME) {
106 hline(ACS_HLINE, xsz - 2);
107 move(y + ysz - 1, x + 1);
108 hline(ACS_HLINE, xsz - 2);
110 vline(ACS_VLINE, ysz - 2);
111 move(y + 1, x + xsz - 1);
112 vline(ACS_VLINE, ysz - 2);
114 mvaddch(y, x, ACS_ULCORNER);
115 mvaddch(y, x + xsz - 1, ACS_URCORNER);
116 mvaddch(y + ysz - 1, x, ACS_LLCORNER);
117 mvaddch(y + ysz - 1, x + xsz - 1, ACS_LRCORNER);
121 tg_text(x + 2, y, "%s", label);
124 attroff(COLOR_PAIR(1));
127 static int curses_color(int col)