prosperon/source/engine/timer.h

25 lines
623 B
C
Raw Normal View History

2022-06-21 12:48:19 -05:00
#ifndef TIMER
#define TIMER
struct timer {
int timerid;
2022-08-22 08:55:54 -05:00
int on;
2022-08-25 15:48:15 -05:00
double interval; // Time of timer
2022-08-22 08:55:54 -05:00
int repeat;
2022-08-25 15:48:15 -05:00
double remain_time; // How much time until the timer executes
2022-08-22 08:55:54 -05:00
void (*cb)(void *data);
void *data;
2023-01-19 10:44:29 -06:00
int owndata;
2022-06-21 12:48:19 -05:00
};
2023-01-19 10:44:29 -06:00
struct timer *timer_make(double interval, void (*callback)(void *param), void *param, int own);
2023-01-18 17:15:36 -06:00
struct timer *id2timer(int id);
2022-06-21 12:48:19 -05:00
void timer_remove(struct timer *t);
2022-08-22 08:55:54 -05:00
void timer_start(struct timer *t);
void timer_pause(struct timer *t);
void timer_stop(struct timer *t);
2022-12-28 16:50:54 -06:00
void timer_update(double dt);
void timerr_settime(struct timer *t, double interval);
2022-06-21 12:48:19 -05:00
#endif