Cześć,
Mam problem z ncurses. Tworzę nowe okna, dodaje do nich treść, odświeżam ich zawartość, ale nic nie widzę. Wydaje mi się, że współrzędne są prawidłowe. Dlaczego więc poniższy kod nie działa?
#include<ncurses.h>
#include<stdlib.h>
void bomb(void)
{
addstr("Unable to allocate memory for new window.\n");
refresh();
endwin();
exit(1);
}
int main(void)
{
WINDOW *a = NULL, *b = NULL, *c = NULL, *d = NULL;
int maxx, maxy, halfx, halfy;
initscr();
start_color();
init_pair(1, COLOR_BLACK, COLOR_CYAN);
getmaxyx(stdscr, maxy, maxx);
halfx = maxx >> 1;
halfy = maxy >> 1;
if( ( a = newwin(halfy, halfx, 0, 0) ) == NULL ) bomb();
if( ( a = newwin(halfy, halfx, 0, halfx )) == NULL ) bomb();
if( ( a = newwin(halfy, halfx, halfy, 0) ) == NULL ) bomb();
if( ( a = newwin(halfy, halfx, halfy, halfx) ) == NULL ) bomb();
mvwaddstr(a, 0, 0, "This is window A!\n");
wbkgd(a, COLOR_PAIR(1));
wrefresh(a);
mvwaddstr(b, 0, 0, "This is window B!\n");
wrefresh(b);
mvwaddstr(c, 0, 0, "This is window C!\n");
wrefresh(c);
mvwaddstr(d, 0, 0, "This is window D!\n");
wrefresh(d);
getch();
endwin();
return 0;
}
Dzięki za wskazówkę (dość mocno zależy mi na obsłudze okien),