Changeset 916 for code/branches/input/src/orxonox/tools/Timer.cc
- Timestamp:
- Mar 21, 2008, 3:50:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/orxonox/tools/Timer.cc
r893 r916 46 46 this->time_ = 0; 47 47 } 48 49 /** 50 @brief Updates the timer before the frames are rendered. 51 */ 52 void TimerBase::tick(float dt) 53 { 54 if (this->bActive_) 55 { 56 // If active: Decrease the timer by the duration of the last frame 57 this->time_ -= dt; 58 59 if (this->time_ <= 0) 60 { 61 // It's time to call the function 62 if (this->bLoop_) 63 // Q: Why '+=' and not '='? A: Think about it. It's more accurate like that. Seriously. 64 this->time_ += this->interval_; 65 else 66 this->stopTimer(); // Stop the timer if we don't want to loop 67 68 this->run(); 69 } 70 } 71 } 72 48 73 }
Note: See TracChangeset
for help on using the changeset viewer.