diff options
Diffstat (limited to 'src/menu/timer.cpp')
-rw-r--r-- | src/menu/timer.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/menu/timer.cpp b/src/menu/timer.cpp index 24da0c68..d091aed5 100644 --- a/src/menu/timer.cpp +++ b/src/menu/timer.cpp @@ -23,12 +23,11 @@ */ #include "timer.hpp" -#include <SDL/SDL.h> namespace usdx { - Timer::Timer(Control* owner, uint32_t duration, bool init) : - Control(owner), duration(duration), last_update(0), ready(init) + Timer::Timer(Control* owner, float duration, bool init) : + Control(owner), duration(duration), ready(init), last_update() { } @@ -36,15 +35,10 @@ namespace usdx { } - uint32_t Timer::now(void) const - { - return SDL_GetTicks(); - } - void Timer::update(void) { ready = false; - last_update = now(); + last_update.update(); } bool Timer::is_ready(void) @@ -52,7 +46,7 @@ namespace usdx if (ready) return true; - if ((now() - last_update) > duration) + if (!last_update.since(duration)) { ready = true; return true; |