From 38bd76bd4d8db5accfce879dc2c5aa6dafa48e19 Mon Sep 17 00:00:00 2001 From: st529yr Date: Wed, 15 May 2024 13:35:49 +0200 Subject: [PATCH] funguje --- final/game.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/final/game.c b/final/game.c index 71b7539..031cf38 100644 --- a/final/game.c +++ b/final/game.c @@ -23,13 +23,13 @@ typedef struct { } GameState; Tetromino tetrominoes[] = { - {{{0,0}, {1,0}, {0,1}, {1,1}}, {0,0}}, // Square - {{{0,0}, {1,0}, {2,0}, {3,0}}, {0,0}}, // Line - {{{0,0}, {1,0}, {1,1}, {2,1}}, {0,0}}, // Z shape - {{{1,0}, {2,0}, {0,1}, {1,1}}, {0,0}}, // S shape - {{{0,0}, {1,0}, {2,0}, {1,1}}, {0,0}}, // T shape - {{{0,0}, {0,1}, {1,1}, {2,1}}, {0,0}}, // L shape - {{{2,0}, {0,1}, {1,1}, {2,1}}, {0,0}} // J shape + {{{0,0}, {1,0}, {0,1}, {1,1}}, {0,0}}, // Štvorec + {{{0,0}, {1,0}, {2,0}, {3,0}}, {0,0}}, // Čiara + {{{0,0}, {1,0}, {1,1}, {2,1}}, {0,0}}, // Z tvar + {{{1,0}, {2,0}, {0,1}, {1,1}}, {0,0}}, // S tvar + {{{0,0}, {1,0}, {2,0}, {1,1}}, {0,0}}, // T tvar + {{{0,0}, {0,1}, {1,1}, {2,1}}, {0,0}}, // L tvar + {{{2,0}, {0,1}, {1,1}, {2,1}}, {0,0}} // J tvar }; void draw_grid(GameState* game) { @@ -130,3 +130,20 @@ int game_event(struct event* event, void* state) { 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; +} +