#include #include #define Sleep(n) sleep(n) int main(void) { int i; int y = 0, x = 0, top_of_screen = 0, bottom_of_screen = 0; initscr(); WINDOW *pad = newpad(LINES * 2, COLS); scrollok(pad, TRUE); getmaxyx(pad, y, x); top_of_screen = y - LINES; bottom_of_screen = top_of_screen + LINES - 1; wmove(pad, top_of_screen, 0); waddstr(pad, "TOP OF SCREEN"); wmove(pad, bottom_of_screen, 0); waddstr(pad, "BOTTOM OF SCREEN"); for (i = top_of_screen + 1; i < bottom_of_screen; i++) mvwaddstr(pad, i, 0, "XXXXXXX"); prefresh(pad, top_of_screen, 0, 0, 0, LINES - 1, COLS - 1); wsetscrreg(pad, top_of_screen + 1, bottom_of_screen - 1); for (i = 0; i < LINES + 10; i++){ wscrl(pad, i % 2? i : -i); prefresh(pad, top_of_screen, 0, 0, 0, LINES - 1, COLS - 1); Sleep(1); } Sleep(10); endwin(); return 0; }