X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Ftimer.hpp;fp=src%2Ftimer.hpp;h=0000000000000000000000000000000000000000;hb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;hp=c5445b2b331a980ed750315671b91955b7fb34da;hpb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;p=blank.git diff --git a/src/timer.hpp b/src/timer.hpp deleted file mode 100644 index c5445b2..0000000 --- a/src/timer.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef BLANK_TIMER_HPP -#define BLANK_TIMER_HPP - - -namespace blank { - -class IntervalTimer { - -public: - explicit IntervalTimer(int interval_ms) noexcept - : intv(interval_ms) { } - - void Start() noexcept { - speed = 1; - } - void Stop() noexcept { - value = 0; - speed = 0; - } - - bool Running() const noexcept { - return speed != 0; - } - bool Hit() const noexcept { - return Running() && value % intv < last_dt; - } - int Elapsed() const noexcept { - return value; - } - int Iteration() const noexcept { - return value / intv; - } - - void Update(int dt) noexcept { - value += dt * speed; - last_dt = dt; - } - -private: - int intv; - int value = 0; - int speed = 0; - int last_dt = 0; - -}; - -} - -#endif