static void init_args(int argc, char **argv) { int i; char *buf; i = 1; while (i < argc) { if (strncmp(argv[i], "-l", 2) == 0) { i++; if (i < argc) { buf = (char *)malloc(strlen(argv[i]) + 2); sprintf(buf, "%s/", argv[i]); SetLocalDir(buf); free(buf); i++; } } else if (strncmp(argv[i], "-L", 2) == 0) { i++; if (i < argc) { buf = (char *)malloc(strlen(argv[i]) + 2); sprintf(buf, "%s/", argv[i]); SetLibDir(buf); free(buf); i++; } } else if (strncmp(argv[i], "-D", 2) == 0) { i++; if (i < argc) { buf = (char *)malloc(strlen(argv[i]) + 2); sprintf(buf, "%s/", argv[i]); SetDataDir(buf); free(buf); i++; } } else if (strncmp(argv[i], "-s", 2) == 0) { i++; SetSingleTextureMode (); #ifndef FREEGLUT } else if (strncmp(argv[i], "-m", 2) == 0) { i++; GfuiMouseSetHWPresent(); /* allow the hardware cursor */ #endif } else { i++; /* ignore bad args */ } } #ifdef FREEGLUT GfuiMouseSetHWPresent(); /* allow the hardware cursor (freeglut pb ?) */ #endif }
bool GfuiApplication::parseOptions() { // Parse command line for registered options, and interpret standard ones. if (!GfApplication::parseOptions()) return false; // Then interpret the specific ones. std::list<Option>::const_iterator itOpt; for (itOpt = _lstOptions.begin(); itOpt != _lstOptions.end(); itOpt++) { // Not found in the command line => ignore / default value. if (!itOpt->bFound) continue; // Allow the hardware mouse cursor if (itOpt->strLongName == "hardmouse") { GfuiMouseSetHWPresent(); } } return true; }
static void init_args(int argc, char **argv, const char **raceconfig) { int i; char *buf; i = 1; while(i < argc) { if(strncmp(argv[i], "-l", 2) == 0) { i++; if(i < argc) { buf = (char *)malloc(strlen(argv[i]) + 2); sprintf(buf, "%s/", argv[i]); SetLocalDir(buf); free(buf); i++; } } else if(strncmp(argv[i], "-L", 2) == 0) { i++; if(i < argc) { buf = (char *)malloc(strlen(argv[i]) + 2); sprintf(buf, "%s/", argv[i]); SetLibDir(buf); free(buf); i++; } } else if(strncmp(argv[i], "-D", 2) == 0) { i++; if(i < argc) { buf = (char *)malloc(strlen(argv[i]) + 2); sprintf(buf, "%s/", argv[i]); SetDataDir(buf); free(buf); i++; } } else if(strncmp(argv[i], "-s", 2) == 0) { i++; SetSingleTextureMode(); } else if(strncmp(argv[i], "-k", 2) == 0) { i++; // Keep modules in memory (for valgrind) printf("Unloading modules disabled, just intended for valgrind runs.\n"); bKeepModules = true; #ifndef FREEGLUT } else if(strncmp(argv[i], "-m", 2) == 0) { i++; GfuiMouseSetHWPresent(); /* allow the hardware cursor */ #endif } else if(strncmp(argv[i], "-r", 2) == 0) { i++; *raceconfig = ""; if(i < argc) { *raceconfig = argv[i]; i++; } if((strlen(*raceconfig) == 0) || (strstr(*raceconfig, ".xml") == 0)) { printf("Please specify a race configuration xml when using -r\n"); exit(1); } } else { i++; /* ignore bad args */ } } #ifdef FREEGLUT GfuiMouseSetHWPresent(); /* allow the hardware cursor (freeglut pb ?) */ #endif }