Changeset 1674 for code/branches/gui/src/orxonox/gamestates/GSLevel.cc
- Timestamp:
- Aug 28, 2008, 8:30:25 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSLevel.cc
r1672 r1674 44 44 GSLevel::GSLevel(const std::string& name) 45 45 : GameState(name) 46 , time factor_(1.0f)46 , timeFactor_(1.0f) 47 47 , keyBinder_(0) 48 48 , inputState_(0) … … 74 74 hud_ = new Level(Settings::getDataPath() + "overlay/hud.oxo"); 75 75 Loader::load(hud_); 76 77 // reset game speed to normal 78 timeFactor_ = 1.0f; 76 79 } 77 80 … … 96 99 } 97 100 98 void GSLevel::ticked( float dt, uint64_ttime)101 void GSLevel::ticked(const Clock& time) 99 102 { 100 103 // Call those objects that need the real time 101 104 for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it) 102 it->tick( dt);105 it->tick(time.getDeltaTime()); 103 106 // Call the scene objects 104 107 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 105 it->tick( dt * this->timefactor_);108 it->tick(time.getDeltaTime() * this->timeFactor_); 106 109 } 107 110 … … 112 115 void GSLevel::setTimeFactor(float factor) 113 116 { 114 float change = factor / this->time factor_;115 this->time factor_ = factor;117 float change = factor / this->timeFactor_; 118 this->timeFactor_ = factor; 116 119 for (Iterator<ParticleInterface> it = ObjectList<ParticleInterface>::begin(); it; ++it) 117 120 it->setSpeedFactor(it->getSpeedFactor() * change); 118 121 119 122 for (Iterator<Backlight> it = ObjectList<Backlight>::begin(); it; ++it) 120 it->setTimeFactor(time factor_);123 it->setTimeFactor(timeFactor_); 121 124 } 122 125
Note: See TracChangeset
for help on using the changeset viewer.