diff options
Diffstat (limited to 'src/main/game/game.c')
-rw-r--r-- | src/main/game/game.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/game/game.c b/src/main/game/game.c index 35d5c21..9881896 100644 --- a/src/main/game/game.c +++ b/src/main/game/game.c @@ -73,13 +73,17 @@ init_log(void) static void game_draw_field(TrisGame *game, float box_size); static char game_next_sign(TrisGame *game); +static Color *COLOR_BOARD; +static Color *COLOR_CIRCLE; +static Color *COLOR_CROSS; + static void draw_frames(void *data) { if (data == NULL) return; TrisGame *game = data; - engine_render_lines(game->board->lines); + engine_render_lines(game->board->lines, COLOR_BOARD); for (int i = 0; i < BOARD_SIZE; i++) { Cell *cell = game->cells[i]; @@ -87,7 +91,7 @@ draw_frames(void *data) engine_render_circle(cell->shape); } else if (cell->sign == SIGN_CROSS) { CrossShape *shape = cell->shape; - engine_render_lines(shape->lines); + engine_render_lines(shape->lines, COLOR_CROSS); } } } @@ -149,6 +153,7 @@ draw_sign(TrisGame *game, Cell *cell) cell_set_sign(cell, sign); if (sign == SIGN_CIRCLE) { cell->shape = engine_circle_new(x, y, l, 120, 1); + engine_circle_set_color(cell->shape, COLOR_CIRCLE); game->sign = SIGN_CROSS; } else if (sign == SIGN_CROSS) { cell->shape = cross_shape_new(x - l, x + l, y + l, y - l); @@ -202,6 +207,10 @@ game_init(int width, int height) game->engine = engine_new(width, height); game->ended = false; + COLOR_BOARD = color_new(1.0f, 1.0f, 0.0f, 1.0f); + COLOR_CIRCLE = color_new(1.0f, 0.3f, 0.5f, 1.0f); + COLOR_CROSS = color_new(0.3f, 0.2f, 0.8f, 1.0f); + engine_set_window_title(game->engine, "Tris Game"); engine_set_mouse_button_listener(game_mouse_button_pressed, game); |