Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!linus!raybed2!applicon!bambi!garrity!garrity From: garrity@garrity.applicon.UUCP Newsgroups: comp.graphics Subject: Re: Munching Squares Message-ID: <31500003@garrity> Date: Mon, 8-Jun-87 15:32:00 EDT Article-I.D.: garrity.31500003 Posted: Mon Jun 8 15:32:00 1987 Date-Received: Sat, 20-Jun-87 03:46:46 EDT References: <6004@eddie.MIT.EDU> Lines: 71 Nf-ID: #R:eddie.MIT.EDU:-600400:garrity:31500003:000:1536 Nf-From: garrity.applicon.UUCP!garrity Jun 8 15:32:00 1987 If you use SunView, the following implementation of munching squares makes a pretty good replacement for the default lockscreen. If you are sick of that life game, simply compile this program into a file called munch, and then type "lockscreen munch" instead of lockscreen. #include #include #include #define SIZE 1280 int alarm_handler(); int restart; main(argc, argv) int argc; char *argv[]; { int seed, acc, fd, x, y; struct pixrect *pr; signal(SIGALRM, alarm_handler); alarm(30); while (1) { if (argc > 1) sscanf(argv[1], "%ld", &seed); else { srandom(time(0)); seed = random(); } acc = seed; pr = pr_open("/dev/fb"); pr_rop(pr, 0, 0, SIZE, SIZE, PIX_SET, 0, 0, 0); restart = 0; while (!restart) { x = acc & 255; y = (acc >> 8) & 255; pr_rop(pr, x * 5, y * 5, 5, 5, PIX_SRC ^ PIX_DST | PIX_COLOR(1), 0, 0, 0); acc += seed; } } } int alarm_handler(sig, code) int sig, code; { restart = 1; alarm(30); } -- Mike Garrity -- -- Asking is just polite demanding. -- Max Headroom -- -- snail: Applicon, a division of Schlumberger Systems, Inc. -- 829 Middlesex Tpk. -- P.O. box 7004 -- Billerica MA, 01821 -- -- uucp: {allegra|decvax|mit-eddie|utzoo}!linus!raybed2!applicon!garrity -- {amd|bbncca|cbosgd|wjh12|ihnp4|yale}!ima!applicon!h iK&$KR