dumb little curses program
Toby Harness
toby at gargoyle.UChicago.UUCP
Sat Dec 22 06:13:43 AEST 1984
/*
* plane.c - a dumb little curses program
*
* cc plane.c -o plane -lcurses -lterm{cap,lib} -O -s
*
* The basic idea of this was stolen from someone unknown at hpfcms
*
* Toby Harness 12/84
*/
#include <curses.h>
#define max(a,b) ((a > b) ? a : b)
main()
{
WINDOW *cloud, *plane, *bomb, *newwin();
int i, j;
initscr();
cloud = newwin(8, 30, 2, 3 * COLS / 5);
plane = newwin(8, COLS, 9, 0);
bomb = newwin(LINES - 15, COLS, 15, 0);
waddstr(cloud, "\
.\n\
. . .\n\
. . .. . ..\n\
. . . . .\n\
. . .. . . .\n\
. . . .");
waddstr(plane, "\
^\n\
| \\ --------\n\
| \\________/ /___|\n\
|-- S U / / 0\n\
<---------/ /-----|\n\
--------");
waddstr(bomb, " rm *");
wrefresh(cloud);
wrefresh(plane);
wrefresh(bomb);
for(j=0; j < COLS; j++) {
/* slowly move the cloud */
wmove(cloud, (j + 12) % 23, 0);
winsch(cloud, ' ');
wrefresh(cloud);
/* move the plane and bomb */
for(i = 0; i < max(9, LINES - 15); i++) {
wmove(plane, i, 0);
winsch(plane, ' ');
wmove(bomb, i, 0);
winsch(bomb, ' ');
}
wrefresh(plane);
/* drop the bomb */
if((j + 10) > (COLS / 2) && j % 2) {
wmove(bomb, 0, 0);
winsertln(bomb);
}
wrefresh(bomb);
}
mvcur(0, COLS - 1, LINES - 1, 0);
endwin();
}
More information about the Comp.sources.unix
mailing list