Changeset 7172
- Timestamp:
- Aug 17, 2010, 8:25:21 PM (14 years ago)
- Location:
- code/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/tools/CMakeLists.txt
r7163 r7172 22 22 LINK_LIBRARIES 23 23 core 24 network25 24 SOURCE_FILES ${TOOLS_SRC_FILES} 26 25 ) -
code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h
r6417 r7172 41 41 virtual ~TimeFactorListener() {} 42 42 43 static void setTimeFactor( float factor);44 static void setTimeFactorInternal( float factor );45 static inline float getTimeFactor(){ return TimeFactorListener::timefactor_s; }43 static void setTimeFactor(float factor); 44 static inline float getTimeFactor() 45 { return TimeFactorListener::timefactor_s; } 46 46 47 47 protected: -
code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
r6417 r7172 38 38 #include "core/CoreIncludes.h" 39 39 #include "core/GameMode.h" 40 #include "network/NetworkFunction.h"41 40 42 41 namespace orxonox … … 45 44 // TimeFactorListener 46 45 //---------------------------- 47 registerStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal );48 49 46 float TimeFactorListener::timefactor_s = 1.0f; 50 47 … … 54 51 } 55 52 56 /*static*/ void TimeFactorListener::setTimeFactor( float factor)53 /*static*/ void TimeFactorListener::setTimeFactor(float factor) 57 54 { 58 if ( !GameMode::isStandalone() ) 59 callStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal, CLIENTID_UNKNOWN, factor ); 60 TimeFactorListener::setTimeFactorInternal(factor); 61 } 55 if (factor == TimeFactorListener::timefactor_s) 56 return; 62 57 63 /*static*/ void TimeFactorListener::setTimeFactorInternal( float factor )64 {65 58 float oldFactor = TimeFactorListener::timefactor_s; 66 59 TimeFactorListener::timefactor_s = factor; -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r6417 r7172 36 36 #include "network/NetworkFunction.h" 37 37 #include "tools/Timer.h" 38 #include "tools/interfaces/TimeFactorListener.h"39 38 #include "tools/interfaces/Tickable.h" 40 39 … … 43 42 DeclareGameState(GSRoot, "root", false, false); 44 43 SetConsoleCommandShortcut(GSRoot, printObjects); 44 45 registerStaticNetworkFunction(&TimeFactorListener::setTimeFactor); 45 46 46 47 GSRoot::GSRoot(const GameStateInfo& info) … … 153 154 } 154 155 155 float GSRoot::getTimeFactor()156 void GSRoot::changedTimeFactor(float factor_new, float factor_old) 156 157 { 157 return TimeFactorListener::getTimeFactor(); 158 if (!GameMode::isStandalone()) 159 callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, CLIENTID_UNKNOWN, factor_new); 158 160 } 159 161 } -
code/trunk/src/orxonox/gamestates/GSRoot.h
r6417 r7172 32 32 #include "OrxonoxPrereqs.h" 33 33 #include "core/GameState.h" 34 #include "tools/interfaces/TimeFactorListener.h" 34 35 35 36 namespace orxonox 36 37 { 37 class _OrxonoxExport GSRoot : public GameState 38 class _OrxonoxExport GSRoot : public GameState, public TimeFactorListener 38 39 { 39 40 public: … … 51 52 void setTimeFactor(float factor); 52 53 void pause(); 53 float getTimeFactor(); 54 55 protected: 56 virtual void changedTimeFactor(float factor_new, float factor_old); 54 57 55 58 private:
Note: See TracChangeset
for help on using the changeset viewer.