-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.h
63 lines (52 loc) · 1.08 KB
/
game.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
#ifndef GAME_H
#define GAME_H
#if defined(ALLEGRO)
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_primitives.h>
#endif
struct game_info {
int start[2];
int end[2];
int cur[2];
int *prizes_visited;
int num_prizes;
int num_prizes_orig;
int (*prizes)[2];
int map_size[2];
int *mapv; /* map of indexes */
int *mapw; /* map of values */
char *map; /* map of characters */
};
struct game {
int w, h;
struct game_info gi;
#if defined(ALLEGRO)
ALLEGRO_FONT *font;
ALLEGRO_DISPLAY *display;
ALLEGRO_TIMER *tick;
ALLEGRO_EVENT_QUEUE *ev;
#endif
};
typedef struct
{
float cost;
int steps;
int *path;
} TSP_Node;
#define INF 0x3F3F3F3F
#define NINF 0xC0C0C0C0
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x))
#define mkcostidx(x,y) ((x) + (y) * (G.gi.num_prizes+2))
extern struct game G;
extern TSP_Node *graph;
void game_read(void);
void game_print(void);
#if defined(ALLEGRO)
void gfx_init(int w, int h, int fps);
void gfx_step(void);
void gfx_loop(void);
void gfx_end(void);
#endif
#endif /* GAME_H */