-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.h
58 lines (51 loc) · 1.1 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
/* Game Structs */
typedef struct {
int height;
int width;
int row;
int col;
int isHit;
unsigned short color;
} Brick;
typedef enum {
START,
START_NODRAW,
LEVEL,
LEVEL_NODRAW,
NEXT_LEVEL,
NEXT_LEVEL_NO_DRAW,
LOSE_LIFE,
LOSE_LIFE_NO_DRAW,
GAME_OVER,
GAME_OVER_NO_DRAW,
WIN_GAME,
WIN_GAME_NO_DRAW,
} GAMEState;
typedef struct {
int height;
int width;
int row;
int col;
int oldRow;
int oldCol;
int cdel;
unsigned short color;
} Slider;
typedef struct {
int row;
int col;
int size;
int oldRow;
int oldCol;
int xDir;
int yDir;
unsigned short color;
} Ball;
/* Prototypes */
void drawSlider(Slider *sldptr);
void enableSlider(Slider *sldptr);
void createBall(int row, int col, int size, Ball *ballptr);
void ballMovement(Ball *ballptr, Slider *sldptr, Brick *brptr, int *numBricks, int bricksSize);
void handleCollisions(Ball *ballptr, Slider *sldptr);
void generateBricks(Brick *brptr, int numBricks);
void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bricksSize);