Changeset 6417 for code/trunk/src/libraries/tools/interfaces
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h
r5781 r6417 37 37 class _ToolsExport TimeFactorListener : virtual public OrxonoxClass 38 38 { 39 friend class GSRoot;40 41 39 public: 42 40 TimeFactorListener(); 43 41 virtual ~TimeFactorListener() {} 44 42 43 static void setTimeFactor( float factor ); 44 static void setTimeFactorInternal( float factor ); 45 static inline float getTimeFactor(){ return TimeFactorListener::timefactor_s; } 46 45 47 protected: 46 48 virtual void changedTimeFactor(float factor_new, float factor_old) {} 47 inline float getTimeFactor() const48 { return TimeFactorListener::timefactor_s; }49 49 50 50 private: -
code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
r5781 r6417 37 37 38 38 #include "core/CoreIncludes.h" 39 #include "core/GameMode.h" 40 #include "network/NetworkFunction.h" 39 41 40 42 namespace orxonox … … 43 45 // TimeFactorListener 44 46 //---------------------------- 47 registerStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal ); 48 45 49 float TimeFactorListener::timefactor_s = 1.0f; 46 50 … … 48 52 { 49 53 RegisterRootObject(TimeFactorListener); 54 } 55 56 /*static*/ void TimeFactorListener::setTimeFactor( float factor ) 57 { 58 if ( !GameMode::isStandalone() ) 59 callStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal, CLIENTID_UNKNOWN, factor ); 60 TimeFactorListener::setTimeFactorInternal(factor); 61 } 62 63 /*static*/ void TimeFactorListener::setTimeFactorInternal( float factor ) 64 { 65 float oldFactor = TimeFactorListener::timefactor_s; 66 TimeFactorListener::timefactor_s = factor; 67 for (ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it) 68 it->changedTimeFactor(factor, oldFactor); 50 69 } 51 70
Note: See TracChangeset
for help on using the changeset viewer.