-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgame.h
More file actions
46 lines (37 loc) · 679 Bytes
/
game.h
File metadata and controls
46 lines (37 loc) · 679 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
45
46
#ifndef GAME_H
#define GAME_H
#include <stdbool.h> // bool
#define N_CANDY 5
typedef enum
{
LEFT,
RIGHT,
UP,
DOWN
} e_dir;
typedef struct
{
unsigned short row, col;
} t_pos;
typedef struct
{
t_pos pos;
e_dir dir;
} t_snake;
typedef struct {
t_snake *snake;
unsigned int snake_length;
unsigned int snake_capacity;
t_pos candy[N_CANDY];
unsigned short w_width;
unsigned short w_height;
bool is_running;
bool is_paused;
unsigned char speed;
unsigned int points;
bool should_restart;
void (*start)();
void (*stop)();
} t_game;
t_game *new_game(unsigned short rows, unsigned short cols);
#endif