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));
41 void tg_fgcolor(int col)
43 fgcol = curses_color(col);
44 init_pair(1, fgcol, bgcol);
47 void tg_bgcolor(int col)
49 bgcol = curses_color(col);
50 init_pair(1, fgcol, bgcol);
53 void tg_color(int col)
55 fgcol = curses_color(col & 0xf);
56 bgcol = curses_color((col >> 4) & 0xf);
57 init_pair(1, fgcol, bgcol);
66 void tg_setcursor(int x, int y)
74 void tg_text(int x, int y, const char *fmt, ...)
79 tg_vtext(x, y, fmt, ap);
83 void tg_vtext(int x, int y, const char *fmt, va_list ap)
85 attron(COLOR_PAIR(1));
87 vw_printw(stdscr, fmt, ap);
88 attroff(COLOR_PAIR(1));
92 void tg_rect(const char *label, int x, int y, int xsz, int ysz, unsigned int flags)
96 attron(COLOR_PAIR(1));
98 for(i=0; i<ysz; i++) {
103 if(flags & TGFX_FRAME) {
105 hline(ACS_HLINE, xsz - 2);
106 move(y + ysz - 1, x + 1);
107 hline(ACS_HLINE, xsz - 2);
109 vline(ACS_VLINE, ysz - 2);
110 move(y + 1, x + xsz - 1);
111 vline(ACS_VLINE, ysz - 2);
113 mvaddch(y, x, ACS_ULCORNER);
114 mvaddch(y, x + xsz - 1, ACS_URCORNER);
115 mvaddch(y + ysz - 1, x, ACS_LLCORNER);
116 mvaddch(y + ysz - 1, x + xsz - 1, ACS_LRCORNER);
120 tg_text(x + 2, y, "%s", label);
123 attroff(COLOR_PAIR(1));
126 static int curses_color(int col)