コード例 #1
0
ファイル: spirographx.c プロジェクト: torule/rss-glx
void hack_handle_opts (int argc, char **argv)
{
	timeInterval = 15;
	DETAIL = 45;

	while (1) {
		int c;

#ifdef HAVE_GETOPT_H
		static struct option long_options[] = {
			{"help", 0, 0, 'h'},
			DRIVER_OPTIONS_LONG {"detail", 1, 0, 'd'},
			{"interval", 1, 0, 'i'},
			{0, 0, 0, 0}
		};

		c = getopt_long (argc, argv, DRIVER_OPTIONS_SHORT "hd:i:", long_options, NULL);
#else
		c = getopt (argc, argv, DRIVER_OPTIONS_SHORT "hd:i:");
#endif
		if (c == -1)
			break;

		switch (c) {
			DRIVER_OPTIONS_CASES case 'h':printf ("%s:"
#ifndef HAVE_GETOPT_H
							      " Not built with GNU getopt.h, long options *NOT* enabled."
#endif
							      "\n" DRIVER_OPTIONS_HELP "\t--detail/-d <arg>\n" "\t--interval/-i <arg>\n", argv[0]);
				exit (1);
			case 'd':
				DETAIL = strtol_minmaxdef (optarg, 10, 10, MAXDETAIL, 1, 45, "--detail: ");
				break;
			case 'i':
				timeInterval = strtol_minmaxdef (optarg, 10, 5, 120, 1, 15, "--interval: ");
		}
	}
}
コード例 #2
0
ファイル: lattice.c プロジェクト: torule/rss-glx
void hack_handle_opts (int argc, char **argv)
{
	int change_flag = 0;

	setDefaults (PRESET_REGULAR);

	while (1) {
		int c;

#ifdef HAVE_GETOPT_H
		static struct option long_options[] = {
			{"help", 0, 0, 'h'},
			DRIVER_OPTIONS_LONG
			{"preset", 1, 0, 'p'},
			{"regular", 0, 0, 10},
			{"chainmail", 0, 0, 11},
			{"brassmesh", 0, 0, 12},
			{"computer", 0, 0, 13},
			{"slick", 0, 0, 14},
			{"tasty", 0, 0, 15},
			{"longitude", 1, 0, 'l'},
			{"latitude", 1, 0, 'L'},
			{"thick", 1, 0, 't'},
			{"density", 1, 0, 'd'},
			{"drawdepth", 1, 0, 'D'},
			{"fov", 1, 0, 'o'},
			{"pathrand", 1, 0, 'P'},
			{"speed", 1, 0, 'e'},
			{"texture", 1, 0, 'T'},
			{"industrial", 0, 0, 1},
			{"crystal", 0, 0, 2},
			{"chrome", 0, 0, 3},
			{"brass", 0, 0, 4},
			{"shiny", 0, 0, 5},
			{"ghostly", 0, 0, 6},
			{"circuits", 0, 0, 7},
			{"doughnuts", 0, 0, 8},
			{"smooth", 0, 0, 's'},
			{"no-smooth", 0, 0, 'S'},
			{"fog", 0, 0, 'f'},
			{"no-fog", 0, 0, 'F'},
			{0, 0, 0, 0}
		};

		c = getopt_long (argc, argv, DRIVER_OPTIONS_SHORT "hp:l:L:t:d:D:o:P:e:T:sSfF", long_options, NULL);
#else
		c = getopt (argc, argv, DRIVER_OPTIONS_SHORT "hp:l:L:t:d:D:o:P:e:T:sSfF");
#endif
		if (c == -1)
			break;

		switch (c) {
		DRIVER_OPTIONS_CASES case 'h':
			printf ("%s:"
#ifndef HAVE_GETOPT_H
				" Not built with GNU getopt.h, long options *NOT* enabled."
#endif
				"\n" DRIVER_OPTIONS_HELP 
				"\t--preset/-p <arg>\n" "\t--regular\n" "\t--chainmail\n" "\t--brassmesh\n" "\t--computer\n" "\t--slick\n" "\t--tasty\n"
				"\t--longitude/-l <arg>\n" "\t--latitude/-L <arg>\n" 
				"\t--thick/-t <arg>\n" "\t--density/-d <arg>\n" 
				"\t--drawdepth/-D <arg>\n" "\t--fov/-o <arg>\n" 
				"\t--pathrand/-P <arg>\n" "\t--speed/-e <arg>\n" 
				"\t--texture/-T <arg>\n" "\t--industrial\n" "\t--crystal\n" "\t--chrome\n" "\t--brass\n" "\t--shiny\n" "\t--ghostly\n" "\t--circuits\n" "\t--doughnuts\n"
				"\t--smooth/-s\n" "\t--no-smooth/-S\n" 
				"\t--fog/-f\n" " \t--no-fog/-F\n", argv[0]);
			exit (1);
		case 'p':
			change_flag = 1;
			setDefaults (strtol_minmaxdef (optarg, 10, 1, 6, 0, 1, "--preset: "));
			break;
		case 10:
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
			change_flag = 1;
			setDefaults (c - 9);
			break;
		case 'l':
			change_flag = 1;
			dLongitude = strtol_minmaxdef (optarg, 10, 4, 100, 1, 16, "--longitude: ");
			break;
		case 'L':
			change_flag = 1;
			dLatitude = strtol_minmaxdef (optarg, 10, 2, 100, 1, 8, "--latitude: ");
			break;
		case 't':
			change_flag = 1;
			dThick = strtol_minmaxdef (optarg, 10, 1, 100, 1, 50, "--thick: ");
			break;
		case 'd':
			change_flag = 1;
			dDensity = strtol_minmaxdef (optarg, 10, 1, 100, 1, 50, "--density: ");
			break;
		case 'D':
			change_flag = 1;
			dDrawdepth = strtol_minmaxdef (optarg, 10, 1, 8, 1, 4, "--drawdepth: ");
			break;
		case 'o':
			change_flag = 1;
			dFov = strtol_minmaxdef (optarg, 10, 10, 150, 1, 90, "--fov: ");
			break;
		case 'P':
			change_flag = 1;
			dPathrand = strtol_minmaxdef (optarg, 10, 1, 10, 1, 1, "--pathrand: ");
			break;
		case 'e':
			change_flag = 1;
			dSpeed = strtol_minmaxdef (optarg, 10, 1, 100, 1, 1, "--speed: ");
			break;
		case 'T':
			change_flag = 1;
			dTexture = strtol_minmaxdef (optarg, 10, 0, 9, 0, 0, "--texture: ");
			break;
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
		case 7:
		case 8:
			change_flag = 1;
			dTexture = c;
			break;
		case 's':
			change_flag = 1;
			dSmooth = 1;
			break;
		case 'S':
			change_flag = 1;
			dSmooth = 0;
			break;
		case 'f':
			change_flag = 1;
			dFog = 1;
			break;
		case 'F':
			change_flag = 1;
			dFog = 0;
			break;
		}
	}

	if (!change_flag) {
		setDefaults (rsRandi (6) + 1);
	}
}
コード例 #3
0
ファイル: hufo_tunnel.cpp プロジェクト: torule/rss-glx
void hack_handle_opts (int argc, char **argv)
{
	int change_flag = 0;

	dTexture = 1;
	dCoarse = 0;
	dSinHole = 0;
	dWireframe = 0;

	while (1) {
		int c;

#ifdef HAVE_GETOPT_H
		static struct option long_options[] = {
			{"help", 0, 0, 'h'},
			DRIVER_OPTIONS_LONG 
			{"texture", 1, 0, 't'},
			{"swirl", 0, 0, 1},
			{"marble", 0, 0, 2},
			{"coarseness", 1, 0, 'c'},
			{"sinusoide", 0, 0, 's'},
			{"no-sinusoide", 0, 0, 'S'},
			{"wireframe", 0, 0, 'w'},
			{"no-wireframe", 0, 0, 'W'},
			{0, 0, 0, 0}
		};

		c = getopt_long (argc, argv, DRIVER_OPTIONS_SHORT "hc:t:sSwW", long_options, NULL);
#else
		c = getopt (argc, argv, DRIVER_OPTIONS_SHORT "hc:t:sSwW");
#endif
		if (c == -1)
			break;

		switch (c) {
		DRIVER_OPTIONS_CASES case 'h':
			printf ("%s:"
#ifndef HAVE_GETOPT_H
				" Not built with GNU getopt.h, long options *NOT* enabled."
#endif
				"\n" DRIVER_OPTIONS_HELP "\t--texture/-t <arg>\n" "\t--swirl\n" "\t--marble\n" "\t--coarseness/-c <arg>\n" "\t--sinusoide/-s\n" "\t--no-sinusoide/-S\n" 
				"\t--wireframe/-w\n" "\t--no-wireframe/-W\n", argv[0]);
			exit (1);
		case 't':
			change_flag = 1;
			dTexture = strtol_minmaxdef (optarg, 10, 0, 2, 0, 1, "--texture: ");
			break;
		case 1:
			change_flag = 1;
			dTexture = 1;
			break;
		case 2:
			change_flag = 1;
			dTexture = 2;
			break;
		case 'c':
			change_flag = 1;
			dCoarse = 1 << (3 - strtol_minmaxdef (optarg, 10, 0, 3, 1, 0, "--coarseness: "));

			if (dCoarse == 8)
				dCoarse = 0;

			break;
		case 's':
			change_flag = 1;
			dSinHole = 1;
			break;
		case 'S':
			change_flag = 1;
			dSinHole = 0;
			break;
		case 'w':
			change_flag = 1;
			dWireframe = 1;
			break;
		case 'W':
			change_flag = 1;
			dWireframe = 0;
			break;
		}
	}

	if (!change_flag) {
		dTexture = rsRandi (2) + 1;
		dCoarse = 1 << (3 - rsRandi (4));

		if (dCoarse == 8)
			dCoarse = 0;

		dSinHole = rsRandi (2);
		dWireframe = (rsRandi (10) == 0);
	}
}
コード例 #4
0
void lt_hack_handle_opts (int argc, char **argv)
{
	setDefaults (PRESET_COMPUTER);

	option_t *optList, *thisOpt;
	optList = NULL;
	optList = GetOptList(argc, argv, "hp:l:L:t:d:D:o:P:e:T:sSfF");

	int change_flag = 0;

	while (optList != NULL) {
		thisOpt = optList;
		optList = optList->next;

		int c;
		c= (int) thisOpt->option;

		if (c == NULL)
			break;

		switch (c) {
		DRIVER_OPTIONS_CASES case 'h':
			printf ("%s:"
#ifndef HAVE_GETOPT_H
				" Not built with GNU getopt.h, long options *NOT* enabled."
#endif
				"\n" DRIVER_OPTIONS_HELP 
				"\t--preset/-p <arg>\n" "\t--regular\n" "\t--chainmail\n" "\t--brassmesh\n" "\t--computer\n" "\t--slick\n" "\t--tasty\n"
				"\t--longitude/-l <arg>\n" "\t--latitude/-L <arg>\n" 
				"\t--thick/-t <arg>\n" "\t--density/-d <arg>\n" 
				"\t--drawdepth/-D <arg>\n" "\t--fov/-o <arg>\n" 
				"\t--pathrand/-P <arg>\n" "\t--speed/-e <arg>\n" 
				"\t--texture/-T <arg>\n" "\t--industrial\n" "\t--crystal\n" "\t--chrome\n" "\t--brass\n" "\t--shiny\n" "\t--ghostly\n" "\t--circuits\n" "\t--doughnuts\n"
				"\t--smooth/-s\n" "\t--no-smooth/-S\n" 
				"\t--fog/-f\n" " \t--no-fog/-F\n", argv[0]);
			exit (1);
		case 'p':
			change_flag = 1;
			setDefaults (strtol_minmaxdef (thisOpt->argument, 10, 1, 6, 0, 1, "--preset: "));
			break;
		case 10:
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
			change_flag = 1;
			setDefaults (c - 9);
			break;
		case 'l':
			change_flag = 1;
			dLongitude = strtol_minmaxdef (optarg, 10, 4, 100, 1, 16, "--longitude: ");
			break;
		case 'L':
			change_flag = 1;
			dLatitude = strtol_minmaxdef (optarg, 10, 2, 100, 1, 8, "--latitude: ");
			break;
		case 't':
			change_flag = 1;
			dThick = strtol_minmaxdef (optarg, 10, 1, 100, 1, 50, "--thick: ");
			break;
		case 'd':
			change_flag = 1;
			dDensity = strtol_minmaxdef (optarg, 10, 1, 100, 1, 50, "--density: ");
			break;
		case 'D':
			change_flag = 1;
			dDrawdepth = strtol_minmaxdef (thisOpt->argument, 10, 1, 8, 1, 4, "--drawdepth: ");
			break;
		case 'o':
			change_flag = 1;
			dFov = strtol_minmaxdef (optarg, 10, 10, 150, 1, 90, "--fov: ");
			break;
		case 'P':
			change_flag = 1;
			dPathrand = strtol_minmaxdef (optarg, 10, 1, 10, 1, 1, "--pathrand: ");
			break;
		case 'e':
			change_flag = 1;
			dSpeed = strtol_minmaxdef (thisOpt->argument, 10, 1, 100, 1, 1, "--speed: ");
			break;
		case 'T':
			change_flag = 1;
			dTexture = strtol_minmaxdef (optarg, 10, 0, 9, 0, 0, "--texture: ");
			break;
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
		case 7:
		case 8:
			change_flag = 1;
			dTexture = c;
			break;
		case 's':
			change_flag = 1;
			dSmooth = 1;
			break;
		case 'S':
			change_flag = 1;
			dSmooth = 0;
			break;
		case 'f':
			change_flag = 1;
			dFog = 1;
			break;
		case 'F':
			change_flag = 1;
			dFog = 0;
			break;
		}
	}

}
コード例 #5
0
ファイル: helios.cpp プロジェクト: torule/rss-glx
void hack_handle_opts (int argc, char **argv)
{
	dIons = 1500;
	dSize = 10;
	dEmitters = 3;
	dAttracters = 3;
	dSpeed = 10;
	dCameraspeed = 10;
	dSurface = 1;
	dWireframe = 0;
	dBlur = 10;

	while (1) {
		int c;

#ifdef HAVE_GETOPT_H
		static struct option long_options[] = {
			{"help", 0, 0, 'h'},
			DRIVER_OPTIONS_LONG {"ions", 1, 0, 'i'},
			{"size", 1, 0, 's'},
			{"emitters", 1, 0, 'e'},
			{"attracters", 1, 0, 'a'},
			{"speed", 1, 0, 'S'},
			{"cameraspeed", 1, 0, 'c'},
			{"surface", 0, 0, 'u'},
			{"no-surface", 0, 0, 'U'},
			{"blur", 1, 0, 'b'},
			{"wireframe", 0, 0, 'w'},
			{"no-wireframe", 0, 0, 'W'},
			{0, 0, 0, 0}
		};

		c = getopt_long (argc, argv, DRIVER_OPTIONS_SHORT "hi:s:e:a:S:c:uUb:wW", long_options, NULL);
#else
		c = getopt (argc, argv, DRIVER_OPTIONS_SHORT "hi:s:e:a:S:c:uUb:wW");
#endif
		if (c == -1)
			break;

		switch (c) {
			DRIVER_OPTIONS_CASES case 'h':printf ("%s:"
#ifndef HAVE_GETOPT_H
							      " Not built with GNU getopt.h, long options *NOT* enabled."
#endif
							      "\n" DRIVER_OPTIONS_HELP "\t--ions/-i <arg>\n" "\t--size/-s <arg>\n" "\t--emitters/-e <arg>\n"
							      "\t--attracters/-a <arg>\n" "\t--speed/-S <arg>\n" "\t--cameraspeed/-c <arg>\n" "\t--surface/-u\n"
							      "\t--no-surface/-U\n" "\t--blur/-b <arg>\n" "\t--wireframe/-w\n" "\t--no-wireframe/-W\n", argv[0]);
			exit (1);
		case 'i':
			dIons = strtol_minmaxdef (optarg, 10, 0, 30000, 1, 1500, "--ions: ");
			break;
		case 's':
			dSize = strtol_minmaxdef (optarg, 10, 1, 100, 1, 10, "--size: ");
			break;
		case 'e':
			dEmitters = strtol_minmaxdef (optarg, 10, 1, 10, 1, 3, "--emitters: ");
			break;
		case 'a':
			dAttracters = strtol_minmaxdef (optarg, 10, 1, 10, 1, 3, "--attracters: ");
			break;
		case 'S':
			dSpeed = strtol_minmaxdef (optarg, 10, 1, 100, 1, 10, "--speed: ");
			break;
		case 'c':
			dCameraspeed = strtol_minmaxdef (optarg, 10, 0, 100, 1, 10, "--cameraspeed: ");
			break;
		case 'u':
			dSurface = 1;
			break;
		case 'U':
			dSurface = 0;
			break;
		case 'b':
			dBlur = strtol_minmaxdef (optarg, 10, 0, 100, 1, 10, "--blur: ");
			break;
		case 'w':
			dWireframe = 1;
			break;
		case 'W':
			dWireframe = 0;
			break;
		}
	}
}