]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Timer.cc
minor refactoring and state progress
[chaz/yoink] / src / Moof / Timer.cc
index d28d5e89fd9d8ef39b379459a0b3a51b6009de3f..d17882a9b3e5b13645e75d91650febedb074293f 100644 (file)
@@ -59,43 +59,43 @@ void Timer::init(const Function& function, Scalar seconds, Mode mode)
 {
        invalidate();
 
-       mode_ = mode;
+       mMode = mode;
 
-       if (mode_ != INVALID)
+       if (mMode != INVALID)
        {
-               function_ = function;
+               mFunction = function;
 
                if (mode == ABSOLUTEE)
                {
-                       absolute_ = seconds;
+                       mAbsolute = seconds;
                }
                else
                {
-                       absolute_ = seconds - getTicks();
-                       interval_ = seconds;
+                       mAbsolute = seconds - getTicks();
+                       mInterval = seconds;
                }
 
-               id_ = getNewID();
-               timers_.insert(std::pair<unsigned,Timer&>(id_, *this));
+               mId = getNewID();
+               timers_.insert(std::pair<unsigned,Timer&>(mId, *this));
 
-               if (absolute_ < nextFire_) nextFire_ = absolute_;
+               if (mAbsolute < nextFire_) nextFire_ = mAbsolute;
        }
 }
 
 
 bool Timer::isValid() const
 {
-       return mode_ != INVALID;
+       return mMode != INVALID;
 }
 
 void Timer::invalidate()
 {
-       if (mode_ != INVALID)
+       if (mMode != INVALID)
        {
-               timers_.erase(id_);
-               mode_ = INVALID;
+               timers_.erase(mId);
+               mMode = INVALID;
 
-               if (isEqual(absolute_, nextFire_)) nextFire_ = findNextFire();
+               if (isEqual(mAbsolute, nextFire_)) nextFire_ = findNextFire();
        }
 }
 
@@ -104,14 +104,14 @@ void Timer::fire()
 {
        Scalar t = getTicks();
 
-       if (function_) function_(*this, t);
+       if (mFunction) mFunction(*this, t);
 
        if (isRepeating())
        {
-               Scalar absolute = absolute_;
+               Scalar absolute = mAbsolute;
 
-               if (isEqual(absolute_, t, 1.0)) absolute_ += interval_;
-               else absolute_ = interval_ + t;
+               if (isEqual(mAbsolute, t, 1.0)) mAbsolute += mInterval;
+               else mAbsolute = mInterval + t;
 
                if (isEqual(absolute, nextFire_)) nextFire_ = findNextFire();
        }
@@ -129,7 +129,7 @@ Scalar Timer::findNextFire()
 
        for (it = timers_.begin(); it != timers_.end(); ++it)
        {
-               Scalar absolute = (*it).second.absolute_;
+               Scalar absolute = (*it).second.mAbsolute;
                if (absolute < nextFire) nextFire = absolute;
        }
 
@@ -139,7 +139,7 @@ Scalar Timer::findNextFire()
 
 Scalar Timer::getSecondsRemaining() const
 {
-       return absolute_ - getTicks();
+       return mAbsolute - getTicks();
 }
 
 bool Timer::isExpired() const
@@ -149,7 +149,7 @@ bool Timer::isExpired() const
 
 bool Timer::isRepeating() const
 {
-       return mode_ == REPEAT;
+       return mMode == REPEAT;
 }
 
 
This page took 0.026757 seconds and 4 git commands to generate.