2020-11-29 16:50:49 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-29 14:42:05 +01:00
|
|
|
struct timer_struct
|
2020-12-04 16:35:47 +01:00
|
|
|
{
|
|
|
|
int TargetTime;
|
|
|
|
void* Caller;
|
|
|
|
void (* Callback)(int, void*);
|
2020-12-06 14:21:56 +01:00
|
|
|
timer_struct* NextTimer;
|
2020-12-04 16:35:47 +01:00
|
|
|
int TimerId;
|
|
|
|
};
|
|
|
|
|
2020-11-29 16:50:49 +01:00
|
|
|
class timer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static int init(int count);
|
2020-12-04 16:35:47 +01:00
|
|
|
static void uninit();
|
|
|
|
static int kill(int timerId);
|
|
|
|
static int set(float time, void* caller, void (* callback)(int, void*));
|
|
|
|
static int check();
|
2020-11-29 16:50:49 +01:00
|
|
|
|
|
|
|
private:
|
2020-12-06 14:21:56 +01:00
|
|
|
static int SetCount;
|
|
|
|
static timer_struct* ActiveList;
|
|
|
|
static int MaxCount;
|
|
|
|
static int Count;
|
|
|
|
static timer_struct* FreeList;
|
|
|
|
static timer_struct* TimerBuffer;
|
2020-11-29 16:50:49 +01:00
|
|
|
};
|