-
Notifications
You must be signed in to change notification settings - Fork 37
/
urn.h
91 lines (66 loc) · 2.05 KB
/
urn.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef __urn_h__
#define __urn_h__
#define URN_INFO_BEHIND_TIME (1)
#define URN_INFO_LOSING_TIME (2)
#define URN_INFO_BEST_SPLIT (4)
#define URN_INFO_BEST_SEGMENT (8)
struct urn_game {
char *path;
char *title;
char *theme;
char *theme_variant;
int attempt_count;
int width;
int height;
long long world_record;
long long start_delay;
char **split_titles;
int split_count;
long long *split_times;
long long *segment_times;
long long *best_splits;
long long *best_segments;
};
typedef struct urn_game urn_game;
struct urn_timer {
int started;
int running;
long long now;
long long start_time;
long long time;
long long sum_of_bests;
long long world_record;
int curr_split;
long long *split_times;
long long *split_deltas;
long long *segment_times;
long long *segment_deltas;
int *split_info;
long long *best_splits;
long long *best_segments;
const urn_game *game;
int *attempt_count;
};
typedef struct urn_timer urn_timer;
long long urn_time_now(void);
long long urn_time_value(const char *string);
void urn_time_string(char *string, long long time);
void urn_time_millis_string(char *seconds, char *millis, long long time);
void urn_split_string(char *string, long long time);
void urn_delta_string(char *string, long long time);
int urn_game_create(urn_game **game_ptr, const char *path);
void urn_game_update_splits(urn_game *game, const urn_timer *timer);
void urn_game_update_bests(urn_game *game, const urn_timer *timer);
int urn_game_save(const urn_game *game);
void urn_game_release(urn_game *game);
int urn_timer_create(urn_timer **timer_ptr, urn_game *game);
void urn_timer_release(urn_timer *timer);
int urn_timer_start(urn_timer *timer);
void urn_timer_step(urn_timer *timer, long long now);
int urn_timer_split(urn_timer *timer);
int urn_timer_skip(urn_timer *timer);
int urn_timer_unsplit(urn_timer *timer);
void urn_timer_stop(urn_timer *timer);
int urn_timer_reset(urn_timer *timer);
int urn_timer_cancel(urn_timer *timer);
#endif