Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 10, 2009, 4:44:05 PM (15 years ago)
Author:
landauf
Message:

replaced the old orxonox executable with an orxonox library. linked that library into the new orxonox executable which only contains one file (Orxonox.cc).

File:
1 edited

Legend:

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

    r3370 r5613  
    2727 *
    2828 */
    29  
     29
    3030/**
    3131@file
    3232@brief
    33     Entry point of the program.
     33    The main function of Orxonox.
    3434*/
    3535
     
    3737#include "SpecialConfig.h"
    3838
    39 #ifdef ORXONOX_USE_WINMAIN
    40 # ifndef WIN32_LEAN_AND_MEAN
    41 #  define WIN32_LEAN_AND_MEAN
    42 # endif
    43 #include <windows.h>
    44 #endif
    45 
    46 #include "util/Debug.h"
    4739#include "util/Exception.h"
    4840#include "core/CommandLine.h"
    4941#include "core/Game.h"
     42#include "Main.h"
    5043
    5144SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
     
    5649SetCommandLineSwitch(standalone).information("Start in standalone mode");
    5750
    58 /*
    59 @brief
    60     Main method. Game starts here (except for static initialisations).
    61 */
    62 #ifdef ORXONOX_USE_WINMAIN
    63 INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
    64 #else
    65 int main(int argc, char** argv)
    66 #endif
     51namespace orxonox
    6752{
    68     using namespace orxonox;
    69 
    70     Game* game = 0;
    71     try
     53    /**
     54    @brief
     55        Main method. Game starts here (except for static initialisations).
     56    */
     57    int main(const std::string& strCmdLine)
    7258    {
    73 #ifndef ORXONOX_USE_WINMAIN
    74         std::string strCmdLine;
    75         for (int i = 1; i < argc; ++i)
    76             strCmdLine += argv[i] + std::string(" ");
    77 #endif
    78         game = new Game(strCmdLine);
     59        Game* game = new Game(strCmdLine);
    7960
    8061        game->setStateHierarchy(
     
    10889        else
    10990            Game::getInstance().requestStates("graphics, mainMenu");
     91
     92        game->run();
     93        delete game;
     94
     95        return 0;
    11096    }
    111     catch (const std::exception& ex)
    112     {
    113         COUT(0) << "Orxonox failed to initialise: " << ex.what() << std::endl;
    114         COUT(0) << "Terminating program." << std::endl;
    115         return 1;
    116     }
    117     catch (...)
    118     {
    119         COUT(0) << "Orxonox failed to initialise: " << std::endl;
    120         COUT(0) << "Terminating program." << std::endl;
    121         return 1;
    122     }
    123 
    124     game->run();
    125     delete game;
    126 
    127     return 0;
    12897}
Note: See TracChangeset for help on using the changeset viewer.