1 #ifndef BLANK_APP_INTERVALTIMER_HPP
2 #define BLANK_APP_INTERVALTIMER_HPP
7 /// Timer that hits every n milliseconds. Resolution is that of the
8 /// delta values passed to Update(), minimum 1ms.
9 /// Also tracks the number of iterations as well as milliseconds
14 /// Create a timer that hits every interval_ms milliseconds.
15 /// Initial state is stopped.
16 explicit IntervalTimer(int interval_ms) noexcept
17 : intv(interval_ms) { }
19 void Start() noexcept {
22 void Stop() noexcept {
27 bool Running() const noexcept {
30 /// true if an interval boundary was passed by the last call to Update()
31 bool Hit() const noexcept {
32 return Running() && value % intv < last_dt;
34 int Elapsed() const noexcept {
37 int Iteration() const noexcept {
41 void Update(int dt) noexcept {