Changeset 2662 for code/trunk/src/orxonox/gamestates/GSRoot.h
- Timestamp:
- Feb 14, 2009, 10:17:35 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSRoot.h
r1891 r2662 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include <list> 33 35 #include <OgreLog.h> 34 36 #include "core/RootGameState.h" … … 40 42 { 41 43 friend class ClassIdentifier<GSRoot>; 44 45 public: 46 struct statisticsTickInfo 47 { 48 uint64_t tickTime; 49 uint32_t tickLength; 50 }; 51 42 52 public: 43 53 GSRoot(); … … 46 56 void exitGame() 47 57 { requestState("root"); } 58 59 // this has to be public because proteced triggers a bug in msvc 60 // when taking the function address. 61 void setTimeFactor(float factor); 62 void pause(); 63 float getTimeFactor() { return this->timeFactor_; } 64 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; } 48 71 49 72 private: … … 55 78 void setThreadAffinity(unsigned int limitToCPU); 56 79 80 float timeFactor_; //!< A factor that sets the gamespeed. 1 is normal. 81 bool bPaused_; 82 float timeFactorPauseBackup_; 57 83 Settings* settings_; 58 84 TclBind* tclBind_; 59 85 TclThreadManager* tclThreadManager_; 60 86 Shell* shell_; 87 LuaBind* luaBind_; 88 89 // variables for time statistics 90 uint64_t statisticsStartTime_; 91 std::list<statisticsTickInfo> 92 statisticsTickTimes_; 93 uint32_t periodTickTime_; 94 float avgFPS_; 95 float avgTickTime_; 96 97 // config values 98 unsigned int statisticsRefreshCycle_; 99 unsigned int statisticsAvgLength_; 100 101 // console commands 102 ConsoleCommand* ccExit_; 103 ConsoleCommand* ccSelectGameState_; 104 ConsoleCommand* ccSetTimeFactor_; 105 ConsoleCommand* ccPause_; 106 }; 107 108 class _OrxonoxExport TimeFactorListener : virtual public OrxonoxClass 109 { 110 friend class GSRoot; 111 112 public: 113 TimeFactorListener(); 114 virtual ~TimeFactorListener() {} 115 116 protected: 117 virtual void changedTimeFactor(float factor_new, float factor_old) {} 118 inline float getTimeFactor() const 119 { return TimeFactorListener::timefactor_s; } 120 121 private: 122 static float timefactor_s; 61 123 }; 62 124 }
Note: See TracChangeset
for help on using the changeset viewer.