prosperon/source/engine/timer.h

27 lines
650 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;
2023-03-05 22:05:22 -06: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;
2023-03-05 22:05:22 -06:00
int next;
int app;
2022-06-21 12:48:19 -05:00
};
int timer_make(double interval, void (*callback)(void *param), void *param, int own, int app);
2023-01-18 17:15:36 -06:00
struct timer *id2timer(int id);
2023-03-17 10:25:35 -05:00
void timer_remove(int id);
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);
void timer_update(double dt, double scale);
void timerr_settime(struct timer *t, double interval);
2022-06-21 12:48:19 -05:00
#endif