Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site gargoyle.UChicago.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!gargoyle!toby
From: toby@gargoyle.UChicago.UUCP (Toby Harness)
Newsgroups: net.sources
Subject: dumb little curses program
Message-ID: <254@gargoyle.UChicago.UUCP>
Date: Fri, 21-Dec-84 15:13:43 EST
Article-I.D.: gargoyle.254
Posted: Fri Dec 21 15:13:43 1984
Date-Received: Sat, 22-Dec-84 02:53:35 EST
Organization: U. Chicago - Computer Science
Lines: 74

/*
 * 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 

#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();
}