-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtetrislib.h
43 lines (31 loc) · 873 Bytes
/
tetrislib.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
#ifndef TETRISLIB_H
#define TETRISLIB_H
// Board Specifications ///////////////////////////////////////////////////
#define BOARD_WIDTH 12
#define BOARD_HEIGHT 22
// Pieces and Piece Types ////////////////////////////////////////////////////////
typedef struct {
int pieceShape;
int rotation;
// r and c are the location of the top left tile of the 4x4 piece representation
int r;
int c;
} FallingPiece;
#define NONEXISTENT -1
typedef struct {
int row, col;
char value;
} LedPixel;
#define NUM_PIECES 7
#define NUM_ROTATIONS 4
#define PIECE_BLOCK_SIZE 4
// Game Constants ////////////////////////////////////////////////
#define FAIL_TO_MOVE_OR_ROTATE -4
#define PLAY_AGAIN -3
#define PIECE_STILL_FALLING -2
#define GAME_OVER -1
// Miscellaneous ///////////////////////////////////////////////////
typedef int bool;
#define true 1
#define false 0
#endif