home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Zone
/
VRZONE.ISO
/
mac
/
PC
/
REND386
/
UTILS
/
PLGSTARS
/
PLGSTARS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-09
|
844b
|
31 lines
/* Generate a star field as a .PLG file */
/* Written by Bernie Roehl, November 1992 */
#include <stdio.h>
#include <stdlib.h>
int starcount = 100; /* number of stars to generate */
int colorflag = 0; /* if non-zero, generate random star colors */
#define FSIZE 1000 /* size of the starfield box */
#define STARCOLOR 15 /* stars are, by default, white */
void main(int argc, char *argv[])
{
int i;
randomize();
while (argc > 1) {
if (!stricmp(argv[1], "-c")) colorflag = 1;
else starcount = atoi(argv[1]);
--argc;
++argv;
}
printf("starfield %d %d\n", starcount, starcount);
for (i = 0; i < starcount; ++i)
printf("%d %d %d\n", random(FSIZE), random(FSIZE), random(FSIZE));
for (i = 0; i < starcount; ++i)
printf("0x%04.4X 1 %d\n", colorflag ? (random(15) + 1) : STARCOLOR, i);
}