diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-21 03:29:17 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-21 03:29:17 +0100 |
commit | 196f41688d01b7f0a79567c617fd6dd3171150ff (patch) | |
tree | a39f679bfc3011ccd6ac42c217967dfda24e8a2d /src/menu/timer.cpp | |
parent | 32f1cc8a22f62c18ba350eea440dee3c560fbc19 (diff) | |
download | usdx-196f41688d01b7f0a79567c617fd6dd3171150ff.tar.gz usdx-196f41688d01b7f0a79567c617fd6dd3171150ff.tar.xz usdx-196f41688d01b7f0a79567c617fd6dd3171150ff.zip |
menu/timer: use base/timestamp
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; |