aboutsummaryrefslogtreecommitdiffstats
path: root/tetris.h
blob: 4aaaed81bde0f55c12e2143e0a34bfd5074c73b7 (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef TETRIS_H
#define TETRIS_H

// GAME SETTINGS
static int fps       = 60;
static int font_size = 10;
static int score     = 0;

#define TETROMINO_SIZE_HEIGHT 2
#define TETROMINO_SIZE_WIDTH 4


static Color I =  (Color){0, 255, 255, 255};
static Color O =  (Color){255, 255, 102, 255} ;
static Color T =  (Color){138, 43, 226, 255};
static Color S =  (Color){34, 139, 34, 255} ;
static Color Z =  (Color){255, 69, 0, 255};
static Color J =  (Color){70, 130, 180, 255};
static Color L =  (Color){255, 140, 0, 255};

// Settigs
static int window_width  = 400;
static int window_height = 600
static int columns       = 10;
static int rows          = 20;
static int cell_width    = window_width  / columns;
static int cell_height   = window_height / row;

typedef struct TETROMINO TETROMINO;
struct TETROMINO {
    int x;
    int y;
    Color color;
    int blocks[TETROMINO_SIZE_HEIGHT][TETROMINO_SIZE_WIDTH];

    };

    static TETROMINO TETROMINOES[7] = {
    // Making the tetrominoes in an array design
    {{
    {0, 0, 0, 0},
    {1, 1, 1, 1},
    },
    CYAN_I,
    COLUMNS / 2,
    0},
    // supposed to have 2 forms of rotations
    // default spawn location is: center

    {{
            {0, 1, 1, 0},
            {0, 1, 1, 0},
        },
        YELLOW_O,
        COLUMNS / 2,
        0},
    // supposed to have no rotation forms
    // default spawn location is: center
    {{
            {0, 1, 0, 0},
            {1, 1, 1, 0},
        },
        PURPLE_T,
        0,
        0},
    // flat side left center
    // 4 rotational forms
    {{
            {0, 1, 1, 0},
            {1, 1, 0, 0},
        },
        GREEN_S,
        0,
        0},
    // left center
    // 4 rotational forms
    {{
            {1, 1, 0, 0},
            {0, 1, 1, 0},
        },
        RED_Z,
        0,
        0},
    // left center
    // 4 rotational forms
    {{
            {1, 0, 0, 0},
            {1, 1, 1, 0},
        },
        BLUE_J,
        0,
        0},
    // flat side first and left center
    // 4 rotational forms
    {{
            {0, 0, 1, 0},
            {1, 1, 1, 0},
        },
        ORANGE_L,
        0,
        0},
    // flat side first and left center
    // 4 rotational forms
};



#endif