/** * Checks whether the specified duration (dt) has passed since the last * update. If yes, it updates the time stamp. * @param now Current time * @param dt The timestep in milliseconds * @return */ bool check_advance(const fixed now, const fixed dt) { if (check_reverse(now)) { return false; } if (now >= last + dt) { last = now; return true; } else return false; }
fixed delta_advance(const fixed now) { fixed dt=now-last; if (check_reverse(now)) { return fixed_minus_one; } // check if time has advanced past dt if (now-last>=dt) { last= now; return dt; } else { return fixed_zero; } }
double delta_advance(const double now) { double dt=now-last; if (check_reverse(now)) { return -1; } // QUESTION TB: does that make sense?! seems to me like if(true) {...} if (now-last>=dt) { last= now; return dt; } else { return 0; } }