From 693d830f69b9a4ce6f956f4a688f41180156473e Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 20 May 2025 20:23:59 +0200 Subject: Add logic to get coordinates of the mouse button click --- src/main/game/game.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/game') diff --git a/src/main/game/game.c b/src/main/game/game.c index 0aa4888..2bd0bb5 100644 --- a/src/main/game/game.c +++ b/src/main/game/game.c @@ -17,12 +17,19 @@ * along with Tris Game. If not, see . */ +#include #include #include "../engine/engine.h" #include "game.h" #include "../util.h" #include "../engine/ui/ui.h" +static void +game_mouse_button_pressed(int x, int y) +{ + printf("mouse pressed %d %d\n", x, y); +} + TrisGame * game_init(int width, int height) { @@ -33,6 +40,7 @@ game_init(int width, int height) } 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); -- cgit v1.2.3