Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2008, 12:09:55 AM (16 years ago)
Author:
rgrieder
Message:

Finally managed to have a master InputState which enables:

  • Console always opens
  • Debug overlay toggles visibility in gui mode too

Had to change several other code:

  • ConfigFileManager uses special class instead of enum for ConfigFileType
  • You can add an arbitrary config file and get the ConfigFileType
  • ConfigFileManager is an Ogre singleton too. Created in Main.cc
  • CommandLineArgument "optionsFile" specifies another file for command line arguments
  • CommandLineArgument "settingsFile" declares the file used for settings (orxonox.ini)
  • changed all fileNames to filenames
  • "Loaded config file blah" now uses COUT(3) instead of COUT(0)
  • fixed a bug in ConfigFileManager::load() that cause orxonox.ini to double its size after every call
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/Main.cc

    r2030 r2101  
    4242#include "util/SignalHandler.h"
    4343#include "core/ConfigFileManager.h"
     44#include "core/CommandLine.h"
    4445
    4546#include "gamestates/GSRoot.h"
     
    5152#include "gamestates/GSGUI.h"
    5253#include "gamestates/GSIOConsole.h"
    53 
    54 using namespace orxonox;
    5554
    5655#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
     
    8685//#endif
    8786
     87SetCommandLineArgument(settingsFile, "orxonox.ini");
     88
    8889int main(int argc, char** argv)
    8990{
     91    using namespace orxonox;
     92
    9093    // create a signal handler (only works for linux)
    9194    SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log");
    9295
    93     // Specifiy config file before creating the GameStates in order to have
     96    // Parse command line arguments
     97    try
     98    {
     99        CommandLine::parseAll(argc, argv);
     100    }
     101    catch (ArgumentException& ex)
     102    {
     103        COUT(1) << ex.what() << std::endl;
     104        COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
     105    }
     106
     107    // Create the ConfigFileManager before creating the GameStates in order to have
    94108    // setConfigValues() in the constructor (required).
    95     ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
     109    ConfigFileManager* configFileManager = new ConfigFileManager();
     110    configFileManager->setFilename(ConfigFileType::Settings, CommandLine::getValue("settingsFile").getString());
    96111
    97112    // create the gamestates
     
    115130
    116131    // Here happens the game
    117     root.start(argc, argv);
     132    root.start();
     133
     134    // Destroy ConfigFileManager again.
     135    delete configFileManager;
    118136
    119137    return 0;
Note: See TracChangeset for help on using the changeset viewer.