diff options
Diffstat (limited to 'src/main/game/game.c')
-rw-r--r-- | src/main/game/game.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/game/game.c b/src/main/game/game.c index 72d03b1..40547cc 100644 --- a/src/main/game/game.c +++ b/src/main/game/game.c @@ -40,6 +40,8 @@ int sign = 1; int moves = 0; +static void game_draw_field(TrisGame *game, float box_size, float x, float y); + static void draw_sign(float x, float y) { @@ -102,16 +104,21 @@ game_mouse_button_pressed(float x, float y) TrisGame * game_init(int width, int height) { + /* Init of the TrisGame */ TrisGame *game = malloc(sizeof(TrisGame)); if (game == NULL) { log_error("Error allocating memory for the game"); exit(EXIT_FAILURE); } + game->width = width; + game->height = height; + game->cells = list_create(); + engine_init(width, height); ui_set_title("Tris Game"); engine_set_mouse_button_listener(game_mouse_button_pressed); - game_draw_field(0.5, 0, 0); + game_draw_field(game, 0.5, 0, 0); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { @@ -128,8 +135,8 @@ game_start() engine_loop(); } -void -game_draw_field(float _box_size, float x, float y) +static void +game_draw_field(TrisGame *game, float _box_size, float x, float y) { float half_box = _box_size / 2; engine_draw_line(x - half_box, y + half_box * 3, x - half_box, y - half_box * 3); |