J’ai un soucis, je n’arrive pas à changer la couleur de fond d’une fenêtre avec une interface en curses, en C.
WINDOW *w_out;
WINDOW *w_in;
initscr();
nonl();
echo();
cbreak();
start_color();
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_CYAN, COLOR_GREEN);
init_pair(6, COLOR_MAGENTA, COLOR_BLUE);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
init_pair(8, COLOR_BLACK, COLOR_WHITE);
init_pair(9, COLOR_GREEN, COLOR_BLUE);
w_out = subwin(stdscr, 10, 20, 5, 5);
w_in = subwin(stdscr, 10, 20, 8, 8);
//box(local_win, 0 , 0); //marche pas
touchwin(w_out);
//wbkgdset(w_out, COLOR_BLUE); //marche pas
wattron(w_out, COLOR_PAIR(6));
waddstr(w_out, "salut");
wattroff(w_out, COLOR_PAIR(6));
wrefresh(w_out);
touchwin(w_in);
wattron(w_in, COLOR_PAIR(5));
wprintw(w_in, "%s", "yo");
wattroff(w_in, COLOR_PAIR(5));
wrefresh(w_in);
refresh();
getch();
delwin(w_out);
delwin(w_in);
endwin();
J’aimerai que les sous-fenêtres aient un fond de couleurs différente, ainsi que la fenêtre principale, là tout est noir, hormis le texte.
En Perl, c’est facile, mais en C… j’ai essayé avec wattron, et wbkgdset, mais ça change rien.