funguje
This commit is contained in:
parent
8f6e1ba7f2
commit
38bd76bd4d
31
final/game.c
31
final/game.c
@ -23,13 +23,13 @@ typedef struct {
|
|||||||
} GameState;
|
} GameState;
|
||||||
|
|
||||||
Tetromino tetrominoes[] = {
|
Tetromino tetrominoes[] = {
|
||||||
{{{0,0}, {1,0}, {0,1}, {1,1}}, {0,0}}, // Square
|
{{{0,0}, {1,0}, {0,1}, {1,1}}, {0,0}}, // Štvorec
|
||||||
{{{0,0}, {1,0}, {2,0}, {3,0}}, {0,0}}, // Line
|
{{{0,0}, {1,0}, {2,0}, {3,0}}, {0,0}}, // Čiara
|
||||||
{{{0,0}, {1,0}, {1,1}, {2,1}}, {0,0}}, // Z shape
|
{{{0,0}, {1,0}, {1,1}, {2,1}}, {0,0}}, // Z tvar
|
||||||
{{{1,0}, {2,0}, {0,1}, {1,1}}, {0,0}}, // S shape
|
{{{1,0}, {2,0}, {0,1}, {1,1}}, {0,0}}, // S tvar
|
||||||
{{{0,0}, {1,0}, {2,0}, {1,1}}, {0,0}}, // T shape
|
{{{0,0}, {1,0}, {2,0}, {1,1}}, {0,0}}, // T tvar
|
||||||
{{{0,0}, {0,1}, {1,1}, {2,1}}, {0,0}}, // L shape
|
{{{0,0}, {0,1}, {1,1}, {2,1}}, {0,0}}, // L tvar
|
||||||
{{{2,0}, {0,1}, {1,1}, {2,1}}, {0,0}} // J shape
|
{{{2,0}, {0,1}, {1,1}, {2,1}}, {0,0}} // J tvar
|
||||||
};
|
};
|
||||||
|
|
||||||
void draw_grid(GameState* game) {
|
void draw_grid(GameState* game) {
|
||||||
@ -130,3 +130,20 @@ int game_event(struct event* event, void* state) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
init_world(WIDTH, HEIGHT);
|
||||||
|
void* game = init_game();
|
||||||
|
|
||||||
|
struct event ev;
|
||||||
|
while (1) {
|
||||||
|
ev.key = getch();
|
||||||
|
if (game_event(&ev, game)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endwin();
|
||||||
|
free(game);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user