Changeset 2850 for code/branches/gui/src/orxonox/gamestates/GSRoot.cc
- Timestamp:
- Mar 25, 2009, 11:53:04 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSRoot.cc
r2848 r2850 44 44 { 45 45 AddGameState(GSRoot, "root"); 46 SetCommandLineSwitch(startWithConsole); 46 SetCommandLineSwitch(console); 47 // Shortcuts for easy direct loading 48 SetCommandLineSwitch(server); 49 SetCommandLineSwitch(client); 50 SetCommandLineSwitch(dedicated); 51 SetCommandLineSwitch(standalone); 47 52 48 53 GSRoot::GSRoot(const std::string& name) … … 63 68 { 64 69 // reset game speed to normal 65 t imeFactor_ = 1.0f;70 this->timeFactor_ = 1.0f; 66 71 67 72 { … … 81 86 } 82 87 88 // Load level directly? 89 bool loadLevel = false; 90 if (CommandLine::getValue("standalone").getBool()) 91 { 92 Game::getInstance().requestStates("graphics, standalone, level"); 93 loadLevel = true; 94 } 95 if (CommandLine::getValue("server").getBool()) 96 { 97 Game::getInstance().requestStates("graphics, server, level"); 98 loadLevel = true; 99 } 100 if (CommandLine::getValue("client").getBool()) 101 { 102 Game::getInstance().requestStates("graphics, standalone, level"); 103 loadLevel = true; 104 } 105 if (CommandLine::getValue("dedicated").getBool()) 106 { 107 Game::getInstance().requestStates("dedicated, level"); 108 loadLevel = true; 109 } 110 83 111 // Determine where to start 84 if (CommandLine::getValue("startWithConsole").getBool()) 85 { 86 // Start the game in the console 87 Game::getInstance().requestState("ioConsole"); 88 } 89 else 90 { 91 // Start in GUI main menu 92 Game::getInstance().requestState("graphics"); 93 Game::getInstance().requestState("mainMenu"); 94 } 95 112 if (!loadLevel) 113 { 114 if (CommandLine::getValue("console").getBool()) 115 { 116 // Start the game in the console without 3D graphics 117 Game::getInstance().requestState("ioConsole"); 118 } 119 else 120 { 121 // Start in GUI mode 122 Game::getInstance().requestStates("graphics, mainMenu"); 123 } 124 } 96 125 } 97 126 … … 113 142 void GSRoot::update(const Clock& time) 114 143 { 144 if (this->getActivity().topState) 145 { 146 // This state can not 'survive' on its own. 147 // Load a user interface therefore 148 Game::getInstance().requestState("ioConsole"); 149 } 150 115 151 uint64_t timeBeforeTick = time.getRealMicroseconds(); 116 152 … … 132 168 uint64_t timeAfterTick = time.getRealMicroseconds(); 133 169 134 // Also add our tick time to the list in GSRoot170 // Also add our tick time 135 171 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick); 136 172 }
Note: See TracChangeset
for help on using the changeset viewer.