summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororangerot <orangerot@orangerot.dev>2025-10-15 14:14:08 +0200
committerorangerot <orangerot@orangerot.dev>2025-10-15 14:14:08 +0200
commit4f478efc65b0e601e02cea4a84424c9050ea79fe (patch)
treee682ce299d7cbd42cf2c866d801d3fe05744771f
parent22922a63b0a264d28ad4f1a1f6884b56a37a8e58 (diff)
fix: place active brick
-rw-r--r--game.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/game.c b/game.c
index 50e3be8..73373c0 100644
--- a/game.c
+++ b/game.c
@@ -164,7 +164,7 @@ void mouse_button_callback(int button, int action, int mods) {
int preview_x = camera_x + preview[i].front.x * EYE_SIZE + DOMINO_WIDTH / 2;
int preview_y = camera_y + preview[i].front.y * EYE_SIZE + DOMINO_HEIGHT / 2;
preview[i].front.val = (active_x - preview_x) * (active_x - preview_x) + (active_y - preview_y) * (active_y - preview_y);
- if (min_dist == (size_t)-1) min_dist = 1;
+ if (min_dist == (size_t)-1) min_dist = i;
if (preview[i].front.val < preview[min_dist].front.val) min_dist = i;
}
@@ -177,6 +177,7 @@ void mouse_button_callback(int button, int action, int mods) {
} else {
hand[hand_count++] = active;
}
+ printf("dist: %d\n", preview[min_dist].front.val);
preview_count = 0;
}
}