Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 28, 2009, 10:48:47 PM (16 years ago)
Author:
landauf
Message:

Realized Timer doesn't have to be a template, hence merged TimerBase, Timer and StaticTimer.
Removed the object pointer from Timer for memberfunctions, use createFunctor(f, object) instead.

Location:
code/branches/core5/src/modules/pong
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/modules/pong/Pong.cc

    r5806 r5831  
    5252        this->setHUDTemplate("PongHUD");
    5353
    54         this->starttimer_.setTimer(1.0, false, this, createExecutor(createFunctor(&Pong::startBall)));
     54        this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Pong::startBall, this)));
    5555        this->starttimer_.stopTimer();
    5656
  • code/branches/core5/src/modules/pong/Pong.h

    r5738 r5831  
    6262            PongBall* ball_;
    6363            PongBat* bat_[2];
    64             Timer<Pong> starttimer_;
     64            Timer starttimer_;
    6565    };
    6666}
  • code/branches/core5/src/modules/pong/PongAI.cc

    r5800 r5831  
    6060    PongAI::~PongAI()
    6161    {
    62         for (std::list<std::pair<Timer<PongAI>*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)
     62        for (std::list<std::pair<Timer*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)
    6363            (*it).first->destroy();
    6464    }
     
    231231
    232232            // Add a new Timer
    233             Timer<PongAI>* timer = new Timer<PongAI>(delay, false, this, createExecutor(createFunctor(&PongAI::delayedMove)));
    234             this->reactionTimers_.push_back(std::pair<Timer<PongAI>*, char>(timer, direction));
     233            Timer* timer = new Timer(delay, false, createExecutor(createFunctor(&PongAI::delayedMove, this)));
     234            this->reactionTimers_.push_back(std::pair<Timer*, char>(timer, direction));
    235235        }
    236236        else
     
    246246
    247247        // Destroy the timer and remove it from the list
    248         Timer<PongAI>* timer = this->reactionTimers_.front().first;
     248        Timer* timer = this->reactionTimers_.front().first;
    249249        timer->destroy();
    250250
  • code/branches/core5/src/modules/pong/PongAI.h

    r5738 r5831  
    6565            float strength_;
    6666
    67             std::list<std::pair<Timer<PongAI>*, char> > reactionTimers_;
     67            std::list<std::pair<Timer*, char> > reactionTimers_;
    6868            char movement_;
    6969            char oldMove_;
Note: See TracChangeset for help on using the changeset viewer.