Changeset 1001 for code/branches/core2/src/orxonox/objects
- Timestamp:
- Apr 8, 2008, 1:51:25 AM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/objects/Tickable.cc
r871 r1001 1 1 #include "core/CoreIncludes.h" 2 #include "core/ConsoleCommand.h" 2 3 #include "Tickable.h" 3 4 4 5 namespace orxonox 5 6 { 7 ConsoleCommandShortcutExtern(slomo, AccessLevel::Offline).setDefaultValue(0, 1.0); 8 ConsoleCommandShortcutExtern(setTimeFactor, AccessLevel::Offline).setDefaultValue(0, 1.0); 9 10 static float timefactor = 1.0; 11 void slomo(float factor) 12 { 13 setTimeFactor(factor); 14 } 15 void setTimeFactor(float factor) 16 { 17 timefactor = factor; 18 } 19 float getTimeFactor() 20 { 21 return timefactor; 22 } 23 6 24 /** 7 25 @brief Constructor: Registers the object in the Tickable-list -
code/branches/core2/src/orxonox/objects/Tickable.h
r871 r1001 50 50 class TickFrameListener; // Forward declaration 51 51 52 void slomo(float factor); 53 void setTimeFactor(float factor = 1.0); 54 float getTimeFactor(); 55 52 56 //! The Tickable interface provides a tick(dt) function, that gets called every frame. 53 57 class _OrxonoxExport Tickable : virtual public OrxonoxClass … … 71 75 bool frameStarted(const Ogre::FrameEvent &evt) 72 76 { 77 float dt = evt.timeSinceLastFrame * getTimeFactor(); 73 78 // Iterate through all Tickables and call their tick(dt) function 74 79 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ) 75 (it++)->tick( evt.timeSinceLastFrame);80 (it++)->tick(dt); 76 81 77 82 return FrameListener::frameStarted(evt);
Note: See TracChangeset
for help on using the changeset viewer.