[612] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1293] | 3 | * > www.orxonox.net < |
---|
[612] | 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
[1755] | 24 | * Reto Grieder |
---|
[612] | 25 | * Co-authors: |
---|
| 26 | * ... |
---|
| 27 | * |
---|
| 28 | */ |
---|
[5613] | 29 | |
---|
[3196] | 30 | /** |
---|
| 31 | @file |
---|
| 32 | @brief |
---|
[5613] | 33 | The main function of Orxonox. |
---|
[3196] | 34 | */ |
---|
[612] | 35 | |
---|
[3196] | 36 | #include "OrxonoxPrereqs.h" |
---|
[3323] | 37 | #include "SpecialConfig.h" |
---|
[612] | 38 | |
---|
[3280] | 39 | #include "util/Exception.h" |
---|
[3370] | 40 | #include "core/CommandLine.h" |
---|
[2896] | 41 | #include "core/Game.h" |
---|
[5613] | 42 | #include "Main.h" |
---|
[612] | 43 | |
---|
[3370] | 44 | SetCommandLineSwitch(console).information("Start in console mode (text IO only)"); |
---|
| 45 | // Shortcuts for easy direct loading |
---|
| 46 | SetCommandLineSwitch(server).information("Start in server mode"); |
---|
| 47 | SetCommandLineSwitch(client).information("Start in client mode"); |
---|
| 48 | SetCommandLineSwitch(dedicated).information("Start in dedicated server mode"); |
---|
| 49 | SetCommandLineSwitch(standalone).information("Start in standalone mode"); |
---|
| 50 | |
---|
[5613] | 51 | namespace orxonox |
---|
[622] | 52 | { |
---|
[5613] | 53 | /** |
---|
| 54 | @brief |
---|
| 55 | Main method. Game starts here (except for static initialisations). |
---|
| 56 | */ |
---|
| 57 | int main(const std::string& strCmdLine) |
---|
[2103] | 58 | { |
---|
[5613] | 59 | Game* game = new Game(strCmdLine); |
---|
[2103] | 60 | |
---|
[3280] | 61 | game->setStateHierarchy( |
---|
[2896] | 62 | "root" |
---|
| 63 | " graphics" |
---|
| 64 | " mainMenu" |
---|
| 65 | " standalone" |
---|
| 66 | " level" |
---|
| 67 | " server" |
---|
| 68 | " level" |
---|
| 69 | " client" |
---|
| 70 | " level" |
---|
| 71 | " dedicated" |
---|
| 72 | " level" |
---|
| 73 | " ioConsole" |
---|
| 74 | ); |
---|
[2710] | 75 | |
---|
[3280] | 76 | game->requestState("root"); |
---|
[3370] | 77 | |
---|
| 78 | // Some development hacks (not really, but in the future, this calls won't make sense anymore) |
---|
| 79 | if (CommandLine::getValue("standalone").getBool()) |
---|
| 80 | Game::getInstance().requestStates("graphics, standalone, level"); |
---|
| 81 | else if (CommandLine::getValue("server").getBool()) |
---|
| 82 | Game::getInstance().requestStates("graphics, server, level"); |
---|
| 83 | else if (CommandLine::getValue("client").getBool()) |
---|
| 84 | Game::getInstance().requestStates("graphics, client, level"); |
---|
| 85 | else if (CommandLine::getValue("dedicated").getBool()) |
---|
| 86 | Game::getInstance().requestStates("dedicated, level"); |
---|
| 87 | else if (CommandLine::getValue("console").getBool()) |
---|
| 88 | Game::getInstance().requestStates("ioConsole"); |
---|
| 89 | else |
---|
| 90 | Game::getInstance().requestStates("graphics, mainMenu"); |
---|
[2927] | 91 | |
---|
[5613] | 92 | game->run(); |
---|
| 93 | delete game; |
---|
[2716] | 94 | |
---|
[5613] | 95 | return 0; |
---|
| 96 | } |
---|
[612] | 97 | } |
---|