Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4063 in orxonox.OLD for orxonox/branches/md2_loader/src/orxonox.cc


Ignore:
Timestamp:
May 5, 2005, 2:37:08 PM (19 years ago)
Author:
patrick
Message:

orxonox/branche/md2_loader: merged trunk into my branche

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/orxonox.cc

    r4010 r4063  
    2222   main-programmer: Patrick Boenzli
    2323   co-programmer: Christian Meyer
    24    co-programmer: Benjamin Grauer: injected ResourceManager/GraphicsEngine
     24   co-programmer: Benjamin Grauer: injected ResourceManager/GraphicsEngine/GUI
    2525*/
    2626
    2727#include "orxonox.h"
     28
     29#include "gui.h"
    2830
    2931#include "world.h"
     
    3739
    3840#include <string.h>
     41
    3942int verbose = 4;
    4043
     
    4649Orxonox::Orxonox ()
    4750{
    48   pause = false;
     51  this->pause = false;
     52
     53  this->world = NULL;
     54  this->resources = NULL;
     55  this->localinput = NULL;
    4956}
    5057
     
    5461Orxonox::~Orxonox ()
    5562{
     63  int i =0;
    5664  Orxonox::singletonRef = NULL;
    5765  if( world != NULL) delete world;
    58   if( localinput != NULL) delete world;
     66  if( localinput != NULL) delete localinput;
    5967  if( resources != NULL) delete resources;
    6068  delete GraphicsEngine::getInstance(); // deleting the Graphics
     
    168176  PRINT(3)("initializing ResourceManager\n");
    169177  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    }
    171183
    172184  PRINT(3)("initializing TextEngine\n");
     
    281293
    282294
     295bool showGui = false;
    283296
    284297/**
     
    302315
    303316  int i;
    304   for(i = 0; i < argc; ++i)
     317  for(i = 1; i < argc; ++i)
    305318    {
    306319      if(! strcmp( "--help", argv[i])) return startHelp();
    307320      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
    311325  return startOrxonox(argc, argv);
    312326}
     
    316330int startHelp()
    317331{
    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");
    323338}
    324339
     
    326341int startOrxonox(int argc, char** argv)
    327342{
    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
    329363  Orxonox *orx = Orxonox::getInstance();
    330364 
    331365  if((*orx).init(argc, argv) == -1)
    332366    {
    333       printf("! Orxonox initialization failed\n");
     367      PRINTF(1)("! Orxonox initialization failed\n");
    334368      return -1;
    335369    }
     
    338372 
    339373  delete orx;
     374  ResourceManager::deleteFile("~/.orxonox/orxonox.lock");
    340375 
    341376}
Note: See TracChangeset for help on using the changeset viewer.