static void test_set_tabsize(void) { int y0, x0; int y, x; int save_tabsize = TABSIZE; (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ for (y = 0; y < LINES; ++y) { set_tabsize(y + 1); if (move(y, 0) == ERR) break; for (x = 0; x < COLS;) { addch('\t'); if (addch('*') == ERR) { break; } getyx(stdscr, y0, x0); if (y0 != y || x0 == x) { break; } } } getch(); erase(); set_tabsize(save_tabsize); }
// // Initalise ncurses et les paires de couleurs. // void initDisplay() { //initialisation écran initscr(); //initialisation couleurs start_color(); //utiliser les couleurs par défaut du terminal use_default_colors(); //paires de couleurs pour chaque robot init_pair(1, COLOR_WHITE, COLOR_RED); init_pair(2, COLOR_WHITE, COLOR_GREEN); init_pair(3, COLOR_WHITE, COLOR_BLUE); init_pair(4, COLOR_BLACK, COLOR_YELLOW); //paires de couleurs pour cases objectif init_pair(11, COLOR_RED, -1); init_pair(12, COLOR_GREEN, -1); init_pair(13, COLOR_BLUE, -1); init_pair(14, COLOR_YELLOW, -1); keypad(stdscr, true); //activation des touches fléchées etc. set_tabsize(4); //taille des tabulations set_escdelay(25); //délai après l'appui sur echap }
SCM gucu_set_TABSIZE (SCM t) { SCM_ASSERT (scm_is_integer (t), t, SCM_ARG1, "set-tabsize!"); set_tabsize (scm_to_int (t)); return SCM_UNSPECIFIED; }
// // Rafraîchit l'affichage pendant une partie. // Affiche le plateau de jeu, ainsi qu'un résumé des informations sur la partie en cours. // void refreshGameDisplay(GameState *state) { if(state == NULL) return; clear(); set_tabsize(4); //taille des tabulations displayGameBoard(state); //affichage du plateau de jeu displayGameStatus(state); //affichage d'infos sur le déroulement du jeu displayScores(state); //affichage des scores displayCommands(); //affichage d'une aide sur les commandes disponibles //si on est en solo : affichage des messages de capture if(state->playersCount == 1) displayRobotCaptureMessage(state->robots); }
void init_display(void) { const char *term; int x, y; die_callback = done_display; /* XXX: Restore tty modes and let the OS cleanup the rest! */ if (atexit(done_display)) die("Failed to register done_display"); /* Initialize the curses library */ if (isatty(STDIN_FILENO)) { cursed = !!initscr(); opt_tty = stdin; } else { /* Leave stdin and stdout alone when acting as a pager. */ opt_tty = fopen("/dev/tty", "r+"); if (!opt_tty) die("Failed to open /dev/tty"); cursed = !!newterm(NULL, opt_tty, opt_tty); } if (!cursed) die("Failed to initialize curses"); nonl(); /* Disable conversion and detect newlines from input. */ cbreak(); /* Take input chars one at a time, no wait for \n */ noecho(); /* Don't echo input */ leaveok(stdscr, FALSE); if (has_colors()) init_colors(); getmaxyx(stdscr, y, x); status_win = newwin(1, x, y - 1, 0); if (!status_win) die("Failed to create status window"); /* Enable keyboard mapping */ keypad(status_win, TRUE); wbkgdset(status_win, get_line_attr(NULL, LINE_STATUS)); enable_mouse(opt_mouse); #if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20080119) set_tabsize(opt_tab_size); #else TABSIZE = opt_tab_size; #endif term = getenv("XTERM_VERSION") ? NULL : getenv("COLORTERM"); if (term && !strcmp(term, "gnome-terminal")) { /* In the gnome-terminal-emulator, the message from * scrolling up one line when impossible followed by * scrolling down one line causes corruption of the * status line. This is fixed by calling wclear. */ use_scroll_status_wclear = TRUE; use_scroll_redrawwin = FALSE; } else if (term && !strcmp(term, "xrvt-xpm")) { /* No problems with full optimizations in xrvt-(unicode) * and aterm. */ use_scroll_status_wclear = use_scroll_redrawwin = FALSE; } else { /* When scrolling in (u)xterm the last line in the * scrolling direction will update slowly. */ use_scroll_redrawwin = TRUE; use_scroll_status_wclear = FALSE; } }
void init_display(void) { bool no_display = !!getenv("TIG_NO_DISPLAY"); const char *term; int x, y; die_callback = done_display; /* XXX: Restore tty modes and let the OS cleanup the rest! */ if (atexit(done_display)) die("Failed to register done_display"); /* Initialize the curses library */ { /* Leave stdin and stdout alone when acting as a pager. */ FILE *out_tty; opt_tty = fopen("/dev/tty", "r+"); out_tty = no_display ? fopen("/dev/null", "w+") : opt_tty; if (!opt_tty || !out_tty) die("Failed to open /dev/tty"); cursed = !!newterm(NULL, out_tty, opt_tty); } if (!cursed) die("Failed to initialize curses"); set_terminal_modes(); init_colors(); getmaxyx(stdscr, y, x); status_win = newwin(1, x, y - 1, 0); if (!status_win) die("Failed to create status window"); /* Enable keyboard mapping */ keypad(status_win, true); wbkgdset(status_win, get_line_attr(NULL, LINE_STATUS)); enable_mouse(opt_mouse); #if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20080119) set_tabsize(opt_tab_size); #else TABSIZE = opt_tab_size; #endif term = getenv("XTERM_VERSION") ? NULL : (getenv("TERM_PROGRAM") ? getenv("TERM_PROGRAM") : getenv("COLORTERM")); if (term && !strcmp(term, "gnome-terminal")) { /* In the gnome-terminal-emulator, the warning message * shown when scrolling up one line while the cursor is * on the first line followed by scrolling down one line * corrupts the status line. This is fixed by calling * wclear. */ use_scroll_status_wclear = true; use_scroll_redrawwin = false; } else if (term && (!strcmp(term, "xrvt-xpm") || !strcmp(term, "Apple_Terminal") || !strcmp(term, "iTerm.app"))) { /* No problems with full optimizations in * xrvt-(unicode) * aterm * Terminal.app * iTerm2 */ use_scroll_status_wclear = use_scroll_redrawwin = false; } else { /* When scrolling in (u)xterm the last line in the * scrolling direction will update slowly. This is * the conservative default. */ use_scroll_redrawwin = true; use_scroll_status_wclear = false; } }