static void drawbox(void) { chtype bottom[XLENGTH+1]; int n; if(hascolor) attrset(COLOR_PAIR(3)); mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); hline(ACS_HLINE, XLENGTH); mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); for (n = 0; n < XLENGTH; n++) bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); move(YBASE, XBASE - 1); vline(ACS_VLINE, YDEPTH); move(YBASE, XBASE + XLENGTH); vline(ACS_VLINE, YDEPTH); if(hascolor) attrset(COLOR_PAIR(2)); }
static void drawbox(bool scrolling) { chtype bottom[XLENGTH + 1]; int n; if (hascolor) (void) attrset(COLOR_PAIR(PAIR_FRAMES)); MvAddCh(YBASE - 1, XBASE - 1, ACS_ULCORNER); hline(ACS_HLINE, XLENGTH); MvAddCh(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) { for (n = 0; n < XLENGTH; n++) { if (!scrolling) bottom[n] &= ~A_COLOR; bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); } (void) mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); } MvAddCh(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); move(YBASE, XBASE - 1); vline(ACS_VLINE, YDEPTH); move(YBASE, XBASE + XLENGTH); vline(ACS_VLINE, YDEPTH); if (hascolor) (void) attrset(COLOR_PAIR(PAIR_OTHERS)); }
void replace_all_char(char src, char dst) { unsigned long s[2]; for (int i = 0; i <= Y_MAX/g_unit_y; i++) { for (int j = 0; j <= X_MAX/g_unit_x; j++) if (mvinchnstr(i*g_unit_y, j*g_unit_x, s, 1) && s[0] == (unsigned long)src) print_block_point(i, j, dst, g_unit_x); } }