forked from tiehuis/2048-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.h
More file actions
44 lines (37 loc) · 909 Bytes
/
engine.h
File metadata and controls
44 lines (37 loc) · 909 Bytes
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
#ifndef ENGINE_H
#define ENGINE_H
#include <stdio.h>
#include "options.h"
#define fatal(msg)\
do {\
fprintf(stderr, "line %d: %s\n", __LINE__, msg);\
abort();\
} while (0)
struct gamestate {
/* Game state */
int *grid_data_ptr;
int **grid;
int gridsize;
int moved;
long score;
long score_high;
long score_last;
int print_width;
int blocks_in_play;
/* Variable command line options */
struct gameoptions *opts;
};
enum {
dir_invalid,
dir_down,
dir_left,
dir_right,
dir_up
};
struct gfx_state;
int gamestate_end_condition(struct gamestate*);
void gamestate_new_block(struct gamestate*);
int gamestate_tick(struct gfx_state*, struct gamestate*, int, void (*callback)(struct gfx_state*, struct gamestate*));
void gamestate_clear(struct gamestate*);
struct gamestate* gamestate_init(int argc, char **argv);
#endif