From d15108ff7e9aa40243c703607ad732c3ba5db909 Mon Sep 17 00:00:00 2001 From: iamsosmart19 Date: Thu, 30 Dec 2021 16:35:25 +1100 Subject: [PATCH] Replaced hardcoded board square values with global --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8780373..b7210a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,7 +139,7 @@ impl EventHandler for Apr { if mouse::button_pressed(ctx, MouseButton::Left) { let posx = posn.x; let posy = posn.y; - if posx >= self.__test_pawn_x && posx <= self.__test_pawn_x + 20.0 && posy >= self.__test_pawn_y && posy <= self.__test_pawn_y + 20.0 { //In real game don't hardcode size + if posx >= self.__test_pawn_x && posx <= self.__test_pawn_x + BOARD_SQUARE_SIZE && posy >= self.__test_pawn_y && posy <= self.__test_pawn_y + BOARD_SQUARE_SIZE { self.__test_pawn_h_x = self.__test_pawn_x - posx; self.__test_pawn_h_y = self.__test_pawn_y - posy; self.__test_pawn_held = true;