Changeset 2807 for code/branches/gui/src
- Timestamp:
- Mar 19, 2009, 6:11:00 PM (16 years ago)
- Location:
- code/branches/gui/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/Core.cc
r2800 r2807 94 94 SetCommandLineArgument(limitToCPU, 0).information("0: off | #cpu"); 95 95 96 /** 97 @brief Constructor: Registers the object and sets the config-values. 98 @param A reference to a global variable, used to avoid an infinite recursion in getSoftDebugLevel() 99 */ 100 Core::Core(int argc, char** argv) 96 Core::Core() 101 97 { 102 98 RegisterRootObject(Core); … … 104 100 assert(Core::singletonRef_s == 0); 105 101 Core::singletonRef_s = this; 102 } 103 104 Clock* Core::initialise(int argc, char** argv) 105 { 106 // Set up a basic clock to keep time 107 this->gameClock_ = new Clock(); 106 108 107 109 // Parse command line arguments fist … … 173 175 174 176 this->loaded_ = true; 177 178 // Return non const pointer to the game's clock for the main loop 179 return this->gameClock_; 175 180 } 176 181 … … 194 199 // Also delete external console command that don't belong to an Identifier 195 200 CommandExecutor::destroyExternalCommands(); 201 202 delete this->gameClock_; 196 203 197 204 assert(Core::singletonRef_s); -
code/branches/gui/src/core/Core.h
r2800 r2807 61 61 { 62 62 public: 63 Core( int argc, char** argv);63 Core(); 64 64 ~Core(); 65 66 Clock* initialise(int argc, char** argv); 65 67 void setConfigValues(); 66 68 67 bool isLoaded() { return this->loaded_; }68 69 void update(const Clock& time); 69 70 … … 74 75 static const std::string& getLanguage(); 75 76 static void resetLanguage(); 77 78 static const Clock& getGameClock() { return *getInstance().gameClock_; } 76 79 77 80 static void tsetMediaPath(const std::string& path) … … 120 123 TclThreadManager* tclThreadManager_; 121 124 125 Clock* gameClock_; 126 122 127 int softDebugLevel_; //!< The debug level 123 128 int softDebugLevelConsole_; //!< The debug level for the console -
code/branches/gui/src/orxonox/Game.cc
r2805 r2807 89 89 this->abort_ = false; 90 90 91 this->core_ = new orxonox::Core(argc, argv); 92 if (!this->core_->isLoaded()) 93 { 94 COUT(0) << "Core was not fully loaded, probably an exception occurred during consruction. Aborting" << std::endl; 95 abort(); 96 } 91 this->core_ = new orxonox::Core(); 92 this->gameClock_ = this->core_->initialise(argc, argv); 97 93 } 98 94 … … 142 138 root.addChild(&dedicated); 143 139 144 145 // start global orxonox time146 Clock clock;147 148 140 root.activate(); 149 141 … … 153 145 while (!this->abort_) 154 146 { 155 clock.capture();147 this->gameClock_->capture(); 156 148 157 root.tick( clock);149 root.tick(*this->gameClock_); 158 150 159 151 if (root.stateRequest_ != "") -
code/branches/gui/src/orxonox/Game.h
r2805 r2807 61 61 62 62 Core* core_; 63 Clock* gameClock_; 63 64 64 65 bool abort_; -
code/branches/gui/src/orxonox/gamestates/GSClient.cc
r2801 r2807 61 61 GSLevel::enter(); 62 62 63 // TODO: Get Clock from Game or GameStateManager, but with 0 delta time 64 client_->update(Clock()); 63 client_->update(Core::getGameClock()); 65 64 } 66 65
Note: See TracChangeset
for help on using the changeset viewer.