- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/gamestates/GSRoot.h
r2710 r2907 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include <list> 35 #include <OgreLog.h> 36 #include "core/RootGameState.h" 33 #include "core/GameState.h" 37 34 #include "core/OrxonoxClass.h" 38 35 39 36 namespace orxonox 40 37 { 41 class _OrxonoxExport GSRoot : public RootGameState, public OrxonoxClass38 class _OrxonoxExport GSRoot : public GameState 42 39 { 43 friend class ClassIdentifier<GSRoot>;44 45 40 public: 46 struct statisticsTickInfo 47 { 48 uint64_t tickTime; 49 uint32_t tickLength; 50 }; 51 52 public: 53 GSRoot(); 41 GSRoot(const std::string& name); 54 42 ~GSRoot(); 55 43 56 void exitGame() 57 { requestState("root"); } 44 void activate(); 45 void deactivate(); 46 void update(const Clock& time); 58 47 59 48 // this has to be public because proteced triggers a bug in msvc … … 63 52 float getTimeFactor() { return this->timeFactor_; } 64 53 65 float getAvgTickTime() { return this->avgTickTime_; }66 float getAvgFPS() { return this->avgFPS_; }67 68 inline void addTickTime(uint32_t length)69 { assert(!this->statisticsTickTimes_.empty()); this->statisticsTickTimes_.back().tickLength += length;70 this->periodTickTime_+=length; }71 72 54 private: 73 void enter();74 void leave();75 void ticked(const Clock& time);76 77 void setConfigValues();78 void setThreadAffinity(unsigned int limitToCPU);79 80 55 float timeFactor_; //!< A factor that sets the gamespeed. 1 is normal. 81 56 bool bPaused_; 82 57 float timeFactorPauseBackup_; 83 TclBind* tclBind_;84 TclThreadManager* tclThreadManager_;85 Shell* shell_;86 LuaBind* luaBind_;87 88 // variables for time statistics89 uint64_t statisticsStartTime_;90 std::list<statisticsTickInfo>91 statisticsTickTimes_;92 uint32_t periodTickTime_;93 float avgFPS_;94 float avgTickTime_;95 96 // config values97 unsigned int statisticsRefreshCycle_;98 unsigned int statisticsAvgLength_;99 58 100 59 // console commands 101 ConsoleCommand* ccExit_;102 ConsoleCommand* ccSelectGameState_;103 60 ConsoleCommand* ccSetTimeFactor_; 104 61 ConsoleCommand* ccPause_; 105 };106 107 class _OrxonoxExport TimeFactorListener : virtual public OrxonoxClass108 {109 friend class GSRoot;110 111 public:112 TimeFactorListener();113 virtual ~TimeFactorListener() {}114 115 protected:116 virtual void changedTimeFactor(float factor_new, float factor_old) {}117 inline float getTimeFactor() const118 { return TimeFactorListener::timefactor_s; }119 120 private:121 static float timefactor_s;122 62 }; 123 63 }
Note: See TracChangeset
for help on using the changeset viewer.