Changeset 4063 in orxonox.OLD for orxonox/branches/md2_loader/src/orxonox.cc
- Timestamp:
- May 5, 2005, 2:37:08 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/orxonox.cc
r4010 r4063 22 22 main-programmer: Patrick Boenzli 23 23 co-programmer: Christian Meyer 24 co-programmer: Benjamin Grauer: injected ResourceManager/GraphicsEngine 24 co-programmer: Benjamin Grauer: injected ResourceManager/GraphicsEngine/GUI 25 25 */ 26 26 27 27 #include "orxonox.h" 28 29 #include "gui.h" 28 30 29 31 #include "world.h" … … 37 39 38 40 #include <string.h> 41 39 42 int verbose = 4; 40 43 … … 46 49 Orxonox::Orxonox () 47 50 { 48 pause = false; 51 this->pause = false; 52 53 this->world = NULL; 54 this->resources = NULL; 55 this->localinput = NULL; 49 56 } 50 57 … … 54 61 Orxonox::~Orxonox () 55 62 { 63 int i =0; 56 64 Orxonox::singletonRef = NULL; 57 65 if( world != NULL) delete world; 58 if( localinput != NULL) delete world;66 if( localinput != NULL) delete localinput; 59 67 if( resources != NULL) delete resources; 60 68 delete GraphicsEngine::getInstance(); // deleting the Graphics … … 168 176 PRINT(3)("initializing ResourceManager\n"); 169 177 resourceManager = ResourceManager::getInstance(); 170 !resourceManager->setDataDir("../data/"); 178 if (!resourceManager->setDataDir("../data/")) 179 { 180 PRINTF(1)("Data Could not be located\n"); 181 exit(-1); 182 } 171 183 172 184 PRINT(3)("initializing TextEngine\n"); … … 281 293 282 294 295 bool showGui = false; 283 296 284 297 /** … … 302 315 303 316 int i; 304 for(i = 0; i < argc; ++i)317 for(i = 1; i < argc; ++i) 305 318 { 306 319 if(! strcmp( "--help", argv[i])) return startHelp(); 307 320 else if(! strcmp( "--benchmark", argv[i])) return startBenchmarks(); 308 } 309 310 PRINTF(2)("Orxonox does not understand the arguments"); 321 else if(! strcmp( "--gui", argv[i]) || !strcmp("-g", argv[i])) showGui = true; 322 else PRINTF(2)("Orxonox does not understand the arguments %s\n", argv[i]); 323 } 324 311 325 return startOrxonox(argc, argv); 312 326 } … … 316 330 int startHelp() 317 331 { 318 printf("orxonox: starts the orxonox game - rules\n"); 319 printf("usage: orxonox [arg]\n\n"); 320 printf("valid options:\n"); 321 printf(" --benchmark\tstarts the orxonox benchmark\n"); 322 printf(" --help \tshows this menu\n"); 332 PRINT(0)("orxonox: starts the orxonox game - rules\n"); 333 PRINT(0)("usage: orxonox [arg]\n\n"); 334 PRINT(0)("valid options:\n"); 335 PRINT(0)(" --benchmark\tstarts the orxonox benchmark\n"); 336 PRINT(0)(" --help \tshows this menu\n"); 337 PRINT(0)(" --gui/-g \tDisplays the Gui on startup\n"); 323 338 } 324 339 … … 326 341 int startOrxonox(int argc, char** argv) 327 342 { 328 printf(">>> Starting Orxonox <<<\n"); 343 // checking for existence of the configuration-files 344 if (showGui || 345 !ResourceManager::isFile("~/.orxonox/orxonox.conf") || 346 ResourceManager::isFile("~/.orxonox/orxonox.lock")) 347 { 348 if (ResourceManager::isFile("~/.orxonox/orxonox.lock")) 349 ResourceManager::deleteFile("~/.orxonox/orxonox.lock"); 350 // char* guiExec = new char[strlen(argv[0])+20]; 351 // sprintf(guiExec,"%sGui --gui", argv[0]); 352 Gui* gui = new Gui(argc, argv); 353 if (! gui->startOrxonox) 354 return 0; 355 356 delete gui; 357 } 358 359 PRINT(0)(">>> Starting Orxonox <<<\n"); 360 361 ResourceManager::touchFile("~/.orxonox/orxonox.lock"); 362 329 363 Orxonox *orx = Orxonox::getInstance(); 330 364 331 365 if((*orx).init(argc, argv) == -1) 332 366 { 333 printf("! Orxonox initialization failed\n");367 PRINTF(1)("! Orxonox initialization failed\n"); 334 368 return -1; 335 369 } … … 338 372 339 373 delete orx; 374 ResourceManager::deleteFile("~/.orxonox/orxonox.lock"); 340 375 341 376 }
Note: See TracChangeset
for help on using the changeset viewer.