X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,8b69b8434cc8c8e3,start X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 1994-03-24 15:39:11 PST Newsgroups: alt.ascii-art Path: gmd.de!xlink.net!howland.reston.ans.net!pipex!uknet!festival!eddie From: eddie@festival.ed.ac.uk (Eddie Corns) Subject: Re: Alternative approach to anims ?? (mostly unix) References: Message-ID: Organization: Edinburgh University Date: Thu, 24 Mar 1994 23:39:11 GMT Keywords: animation, curses, unix Lines: 72 Program as promised. Compile with cc anim.c -lcurses -o anim seems to work OK on our SYSVish system. Cut out the rest of this article and save to anim.c /* anim - create vt100 etc. codes for animation from seperate frames. * ORIGINAL (when it was called rep) * Ray Lubinsky University of Virginia, Dept. of Computer Science * uucp: decvax!mcnc!ncsu!uvacs!rwl * MODIFIED 3/85 * Bruce Karsh, Univ. Wisconsin, Madison. Dept. of Geophysics. * uucp: uwvax\!geowhiz\!karsh * Modified 22/2/94 - Eddie */ /* Quick description. Each 'frame' is terminated by a line starting with ^L or ^P or text <> (see endpage()). For ^P it does a pause as well. Program copies consecutive lines in each frame to screen. At end of frame the whole screen gets updated. Change the number in do_pause() to suit (or add code to read argv[1]). */ #include #define NextLine fgets(buf,sizeof buf,stdin) main() { char buf[BUFSIZ]; /* Buffer holds a line from 'source' */ int i; initscr(); crmode(); nonl(); clear(); for (;;) { for (i = 0; NextLine != NULL; i++) { if (endpage(buf)) break; mvaddstr(i,0,buf); clrtoeol(); } clrtobot(); refresh(); if (buf[0] == '\020') do_pause(); if (feof(stdin) != 0) break; } /* clear();*/ refresh(); endwin(); } endpage (line) char *line; { if (line[0] == '\f') return 1; if (line[0] == '\020') return 1; if (strcmp(line, "<>") == 0) return 1; return 0; } do_pause () { int i; for (i = 0; i < 40000; i++) putchar ('\0'); }