Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2007, 5:54:06 PM (17 years ago)
Author:
bknecht
Message:

added an argument reader

Location:
code/branches/FICN/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/CMakeLists.txt

    r496 r542  
    1010  Error.cc
    1111  SignalHandler.cc
     12  ArgReader.cc
    1213)
    1314
  • code/branches/FICN/src/orxonox/orxonox.cc

    r541 r542  
    5454#include "objects/Tickable.h"
    5555#include "objects/Timer.h"
     56#include "core/ArgReader.h"
    5657#include "core/Factory.h"
    5758
     
    150151
    151152//      scenemanager->spacehip->tick(evt.timesincelastframe);
    152         if(mKeyboard->isKeyDown(OIS::KC_ESCAPE))
    153           cout << "maximal MouseX: " << maxMouseX << "\tminMouseX: " << minMouseX << endl;
     153        //if(mKeyboard->isKeyDown(OIS::KC_ESCAPE))
     154          //cout << "maximal MouseX: " << maxMouseX << "\tminMouseX: " << minMouseX << endl;
    154155        return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
    155156      }
     
    161162        if(mouseX>maxMouseX) maxMouseX = mouseX;
    162163        if(mouseX<minMouseX) minMouseX = mouseX;
    163         cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl;
     164        //cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl;
    164165        moved = true;
    165166        return true;
     
    210211  void Orxonox::init(int argc, char **argv, std::string path)
    211212  {
    212     //TODO: initialization with command line parameters
    213213    //TODO: find config file (assuming executable directory)
    214214    //TODO: read config file
    215215    //TODO: give config file to Ogre
    216 
    217     if(argc >=2 && strcmp(argv[1], "server")==0)
     216    std::string mode = "";
     217    ArgReader ar = ArgReader(argc, argv);
     218    ar.checkArgument("mode", mode, false);
     219    ar.checkArgument("data-path", path, true);
     220    if(ar.errorHandling()) die();
     221
     222    if(mode == std::string("server"))
    218223    {
    219224      serverInit(path);
    220225    }
    221     else if(argc >=2 && strcmp(argv[1], "client")==0)
     226    else if(mode == std::string("client"))
    222227    {
    223228      clientInit(path);
    224229    }
    225     else if(argc >=2 && strcmp(argv[1], "presentation")==0)
     230    else if(mode == std::string("presentation"))
    226231    {
    227232      playableServer(path);
     
    263268  {
    264269    //TODO: destroy and destruct everything and print nice error msg
     270    delete this;
    265271  }
    266272
Note: See TracChangeset for help on using the changeset viewer.