Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2008, 3:06:33 AM (16 years ago)
Author:
landauf
Message:

Added TimeFactorListener to properly handle changes of the global time factor (makes the game faster or slower). Currently supported in Backlight, ParticleInterface and Timer, which were all critical classes I could think of (all other classes are already covered by the adjustment of dt in tick(dt)). It seems to work well, both with small values (0.1, 0.01) and great values (10, 100). Even pausing the game (0) works fine.

Location:
code/branches/objecthierarchy2/src/orxonox/objects/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc

    r2350 r2406  
    135135        if (this->ribbonTrail_ && this->tickcount_ >= 2)
    136136        {
    137             this->ribbonTrail_->setWidthChange(0, this->width_ * this->getWorldScale() / this->lifetime_/* * Backlight::timeFactor_s*/);
    138             this->ribbonTrail_->setColourChange(0, 0, 0, 0, 1.0f / this->lifetime_/* * Backlight::timeFactor_s*/);
     137            this->ribbonTrail_->setWidthChange(0, this->width_ * this->getWorldScale() / this->lifetime_ * this->getTimeFactor());
     138            this->ribbonTrail_->setColourChange(0, 0, 0, 0, 1.0f / this->lifetime_ * this->getTimeFactor());
    139139        }
    140140    }
     
    227227        }
    228228    }
     229
     230    void Backlight::changedTimeFactor(float factor_new, float factor_old)
     231    {
     232        this->update_lifetime();
     233    }
    229234}
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.h

    r2254 r2406  
    3232#include "OrxonoxPrereqs.h"
    3333#include "FadingBillboard.h"
     34#include "gamestates/GSRoot.h"
    3435
    3536namespace orxonox
    3637{
    37     class _OrxonoxExport Backlight : public FadingBillboard
     38    class _OrxonoxExport Backlight : public FadingBillboard, public TimeFactorListener
    3839    {
    3940        public:
     
    7475            virtual void changedScale();
    7576
     77        protected:
     78            virtual void changedTimeFactor(float factor_new, float factor_old);
     79
    7680        private:
    7781            virtual void startturnonoff();
Note: See TracChangeset for help on using the changeset viewer.