Changeset 2996 for code/branches/netp3
- Timestamp:
- May 20, 2009, 4:13:26 PM (16 years ago)
- Location:
- code/branches/netp3/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp3/src/core/Game.cc
r2927 r2996 168 168 for (std::vector<GameState*>::const_iterator it = this->activeStates_.begin(); 169 169 it != this->activeStates_.end(); ++it) 170 { 171 // Add tick time for most of the states 172 uint64_t timeBeforeTick; 173 if ((*it)->getCountTickTime()) 174 timeBeforeTick = this->gameClock_->getRealMicroseconds(); 175 170 176 (*it)->update(*this->gameClock_); 177 178 if ((*it)->getCountTickTime()) 179 this->addTickTime(this->gameClock_->getRealMicroseconds() - timeBeforeTick); 180 } 171 181 172 182 // STATISTICS -
code/branches/netp3/src/core/Game.h
r2946 r2996 43 43 #include "OrxonoxClass.h" 44 44 45 #define AddGameState(classname, name) \ 46 static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(name)) 45 /** 46 @def 47 Adds a new GameState to the Game. The second parameter is the name as string 48 and every following paramter is a constructor argument (which is usually non existent) 49 */ 50 #define AddGameState(classname, ...) \ 51 static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(__VA_ARGS__)) 47 52 48 53 namespace orxonox -
code/branches/netp3/src/core/GameState.cc
r2896 r2996 45 45 Constructor only initialises variables and sets the name permanently. 46 46 */ 47 GameState::GameState(const std::string& name )47 GameState::GameState(const std::string& name, bool countTickTime) 48 48 : name_(name) 49 , bCountTickTime_(countTickTime) 49 50 , parent_(0) 50 51 { -
code/branches/netp3/src/core/GameState.h
r2896 r2996 78 78 79 79 public: 80 GameState(const std::string& name );80 GameState(const std::string& name, bool countTicktime = true); 81 81 virtual ~GameState(); 82 82 83 83 const std::string& getName() const { return name_; } 84 State getActivity() const { return this->activity_; } 85 GameState* getParent() const { return this->parent_; } 84 State getActivity() const { return this->activity_; } 85 GameState* getParent() const { return this->parent_; } 86 87 bool getCountTickTime() const { return this->bCountTickTime_; } 86 88 87 89 void addChild(GameState* state); … … 102 104 const std::string name_; 103 105 State activity_; 106 const bool bCountTickTime_; 104 107 GameState* parent_; 105 108 std::map<std::string, GameState*> children_; -
code/branches/netp3/src/orxonox/gamestates/GSGraphics.cc
r2928 r2996 57 57 namespace orxonox 58 58 { 59 AddGameState(GSGraphics, "graphics" );60 61 GSGraphics::GSGraphics(const std::string& name )62 : GameState(name )59 AddGameState(GSGraphics, "graphics", false); 60 61 GSGraphics::GSGraphics(const std::string& name, bool countTickTime) 62 : GameState(name, countTickTime) 63 63 , inputManager_(0) 64 64 , console_(0) … … 213 213 uint64_t timeBeforeTick = time.getRealMicroseconds(); 214 214 215 this->inputManager_->update(time); // tick console215 this->inputManager_->update(time); 216 216 this->console_->update(time); 217 this->guiManager_->update(time);218 217 219 218 uint64_t timeAfterTick = time.getRealMicroseconds(); … … 222 221 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick); 223 222 223 // Process gui events 224 this->guiManager_->update(time); 224 225 // Render 225 226 this->graphicsManager_->update(time); -
code/branches/netp3/src/orxonox/gamestates/GSGraphics.h
r2896 r2996 51 51 { 52 52 public: 53 GSGraphics(const std::string& name );53 GSGraphics(const std::string& name, bool countTickTime); 54 54 ~GSGraphics(); 55 55 void setConfigValues(); -
code/branches/netp3/src/orxonox/gamestates/GSRoot.cc
r2928 r2996 43 43 namespace orxonox 44 44 { 45 AddGameState(GSRoot, "root" );45 AddGameState(GSRoot, "root", false); 46 46 SetCommandLineSwitch(console); 47 47 // Shortcuts for easy direct loading … … 51 51 SetCommandLineSwitch(standalone); 52 52 53 GSRoot::GSRoot(const std::string& name )54 : GameState(name )53 GSRoot::GSRoot(const std::string& name, bool countTickTime) 54 : GameState(name, countTickTime) 55 55 , timeFactor_(1.0f) 56 56 , bPaused_(false) -
code/branches/netp3/src/orxonox/gamestates/GSRoot.h
r2896 r2996 39 39 { 40 40 public: 41 GSRoot(const std::string& name );41 GSRoot(const std::string& name, bool countTickTime); 42 42 ~GSRoot(); 43 43
Note: See TracChangeset
for help on using the changeset viewer.