public:
/// Create a timer that hits every interval_ms milliseconds.
/// Initial state is stopped.
- explicit IntervalTimer(int interval_ms) noexcept
+ explicit IntervalTimer(int interval_ms = 0) noexcept
: intv(interval_ms) { }
void Start() noexcept {
value = 0;
speed = 0;
}
+ void Reset() noexcept {
+ value = 0;
+ }
bool Running() const noexcept {
return speed != 0;
bool Hit() const noexcept {
return Running() && value % intv < last_dt;
}
+ bool HitOnce() const noexcept {
+ return Running() && value >= intv;
+ }
int Elapsed() const noexcept {
return value;
}