game pausing

This commit is contained in:
2023-11-30 00:44:00 +02:00
parent 58f605da68
commit c1f8612da5
5 changed files with 111 additions and 62 deletions
+10 -3
View File
@@ -4,12 +4,17 @@
#include <stdio.h>
#include <sys/time.h>
extern struct timeval start_time;
typedef enum TimerState {
TIMER_RUNNING,
TIMER_PAUSED,
TIMER_STOPPED,
} TimerState;
typedef struct Timer {
float time;
float start;
float elapsed;
float duration;
bool is_running;
TimerState state;
} Timer;
double get_time();
@@ -20,3 +25,5 @@ void timer_stop(Timer *timer);
void timer_reset(Timer *timer);
float timer_remaining(Timer *timer);
float timer_elapsed(Timer *timer);
void timer_pause(Timer *timer);
void timer_resume(Timer *timer);