aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Time/Timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Time/Timer.h')
-rw-r--r--src/libjin/Time/Timer.h110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/libjin/Time/Timer.h b/src/libjin/Time/Timer.h
index 7a58e14..93a90ae 100644
--- a/src/libjin/Time/Timer.h
+++ b/src/libjin/Time/Timer.h
@@ -8,69 +8,69 @@
namespace jin
{
-namespace time
-{
+ namespace time
+ {
- class Timers
- {
- public:
- typedef void(*timer_callback)(void* prameters);
+ class Timers
+ {
+ public:
+ typedef void(*timer_callback)(void* prameters);
- Timers();
- ~Timers();
- void update(int ms);
- void every(int ms, timer_callback callback, void* paramters);
- void after(int ms, timer_callback callback, void* paramters);
- void repeat(int ms, int count, timer_callback callback, void* paramters);
+ Timers();
+ ~Timers();
+ void update(int ms);
+ void every(int ms, timer_callback callback, void* paramters);
+ void after(int ms, timer_callback callback, void* paramters);
+ void repeat(int ms, int count, timer_callback callback, void* paramters);
- private:
- class Timer
- {
- public:
- enum Type
- {
- EVERY,
- AFTER,
- REPEAT,
- };
- Timer(Type type, int duration, int count = 0, timer_callback callback = nullptr, void* paramters = nullptr);
- virtual ~Timer();
- bool process(int ms);
- private:
- int duration;
- int count;
- int tickdown;
- int countdown;
- Type type;
- timer_callback callback;
- void* paramters;
- };
- std::vector<Timer*> timers;
+ private:
+ class Timer
+ {
+ public:
+ enum Type
+ {
+ EVERY,
+ AFTER,
+ REPEAT,
+ };
+ Timer(Type type, int duration, int count = 0, timer_callback callback = nullptr, void* paramters = nullptr);
+ virtual ~Timer();
+ bool process(int ms);
+ private:
+ int duration;
+ int count;
+ int tickdown;
+ int countdown;
+ Type type;
+ timer_callback callback;
+ void* paramters;
+ };
+ std::vector<Timer*> timers;
- };
+ };
- inline void sleep(int ms)
- {
- #if LIBJIN_TIME_SDL
- SDL_Delay(ms);
- #endif
- }
+ inline void sleep(int ms)
+ {
+ #if LIBJIN_TIME_SDL
+ SDL_Delay(ms);
+ #endif
+ }
- inline double getSecond()
- {
- #if LIBJIN_TIME_SDL
- return SDL_GetTicks() / 1000.f;
- #endif
- }
+ inline double getSecond()
+ {
+ #if LIBJIN_TIME_SDL
+ return SDL_GetTicks() / 1000.f;
+ #endif
+ }
- inline double getMilliSecond()
- {
- #if LIBJIN_TIME_SDL
- return SDL_GetTicks();
- #endif
- }
+ inline double getMilliSecond()
+ {
+ #if LIBJIN_TIME_SDL
+ return SDL_GetTicks();
+ #endif
+ }
-} // time
+ } // time
} // jin
#endif // LIBJIN_MODULES_TIME