Ncurses::Ncurses(int x, int y) { try { if (check_env() == -1) throw (DisplayException("Environement variable needed")); } catch (const Exception e) { std::cerr << e.what() << std::endl; } initscr(); start_color(); curs_set(FALSE); keypad(stdscr, TRUE); noecho(); nodelay(stdscr, TRUE); _x = x + 2; _y = y + 2; _dtime = 150000; _game = newwin(_y, _x, 0, 0); set_color_pair(); draw_border(); handle_resize(); wrefresh(_game); }
static int show_test_pattern(MENU_ARGS) /* generate a color test pattern */ { int i, j, k; reset_colors(); ed(2); cup(1, 1); printf("There are %d color combinations", MAX_COLORS * MAX_COLORS); for (k = 0; k <= 11; k += 11) { cup(k + 2, 1); printf("%dx%d matrix of foreground/background colors, bright *", MAX_COLORS, MAX_COLORS); if (k) { sgr("1"); printf("on"); sgr("0"); } else { printf("off"); } printf("*"); for (i = 0; i < MAX_COLORS; i++) { cup(k + 3, (i + 1) * 8 + 1); printf("%s", colors[i]); } for (i = 0; i < MAX_COLORS; i++) { cup(k + i + 4, 1); printf("%s", colors[i]); } for (i = 0; i < MAX_COLORS; i++) { for (j = 0; j < MAX_COLORS; j++) { if (k) sgr("1"); set_color_pair(j, i); cup(k + 4 + i, (j + 1) * 8 + 1); printf("Hello"); reset_colors(); } } } reset_colors(); cup(max_lines - 1, 1); return MENU_HOLD; }
void setcolorpair(int clr) { int bg; if (clr != PANEL_LABEL_COLOR) set_color_pair(clr); else if (!_MONOCHROME) { clr = 3; if (TWOPLAYER_MODE) bg = 4; else { bg = (player1.level % 6)+1; if (bg==6) clr = 7; } set_ansi_color(bg, clr, '1'); } }