- Timestamp:
- Apr 8, 2009, 12:58:47 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
r2907 r2908 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include "core/GameState.h" 33 34 #include <list> 35 #include <OgreLog.h> 36 #include "core/RootGameState.h" 34 37 #include "core/OrxonoxClass.h" 35 38 36 39 namespace orxonox 37 40 { 38 class _OrxonoxExport GSRoot : public GameState41 class _OrxonoxExport GSRoot : public RootGameState, public OrxonoxClass 39 42 { 43 friend class ClassIdentifier<GSRoot>; 44 40 45 public: 41 GSRoot(const std::string& name); 46 struct statisticsTickInfo 47 { 48 uint64_t tickTime; 49 uint32_t tickLength; 50 }; 51 52 public: 53 GSRoot(); 42 54 ~GSRoot(); 43 55 44 void activate(); 45 void deactivate(); 46 void update(const Clock& time); 56 void exitGame() 57 { requestState("root"); } 47 58 48 59 // this has to be public because proteced triggers a bug in msvc … … 52 63 float getTimeFactor() { return this->timeFactor_; } 53 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; } 71 54 72 private: 73 void enter(); 74 void leave(); 75 void ticked(const Clock& time); 76 77 void setConfigValues(); 78 void setThreadAffinity(unsigned int limitToCPU); 79 55 80 float timeFactor_; //!< A factor that sets the gamespeed. 1 is normal. 56 81 bool bPaused_; 57 82 float timeFactorPauseBackup_; 83 TclBind* tclBind_; 84 TclThreadManager* tclThreadManager_; 85 Shell* shell_; 86 LuaBind* luaBind_; 87 88 // variables for time statistics 89 uint64_t statisticsStartTime_; 90 std::list<statisticsTickInfo> 91 statisticsTickTimes_; 92 uint32_t periodTickTime_; 93 float avgFPS_; 94 float avgTickTime_; 95 96 // config values 97 unsigned int statisticsRefreshCycle_; 98 unsigned int statisticsAvgLength_; 58 99 59 100 // console commands 101 ConsoleCommand* ccExit_; 102 ConsoleCommand* ccSelectGameState_; 60 103 ConsoleCommand* ccSetTimeFactor_; 61 104 ConsoleCommand* ccPause_; 105 }; 106 107 class _OrxonoxExport TimeFactorListener : virtual public OrxonoxClass 108 { 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() const 118 { return TimeFactorListener::timefactor_s; } 119 120 private: 121 static float timefactor_s; 62 122 }; 63 123 }
Note: See TracChangeset
for help on using the changeset viewer.