summaryrefslogtreecommitdiff
path: root/game.c
diff options
context:
space:
mode:
authororangerot <orangerot@orangerot.dev>2025-10-14 15:09:34 +0200
committerorangerot <orangerot@orangerot.dev>2025-10-14 15:09:34 +0200
commitd5a89c35f1e2e481a01b151616d5ad9e33da20de (patch)
treefba5af586d7b071ebcd575d309b7e572187f1e6b /game.c
parenteb1d51733209b08d711c98ce69eb92c4ee583640 (diff)
fix: domino draw margin
Diffstat (limited to 'game.c')
-rw-r--r--game.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/game.c b/game.c
index 14a8e67..56f2a4a 100644
--- a/game.c
+++ b/game.c
@@ -32,13 +32,14 @@ void cursor_position_callback(int xpos, int ypos) {
}
void mouse_button_callback(int button, int action, int mods) {
- printf("click!\n");
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) {
- if (++eyes_back >= NUM_DOMINO_X) {
+ printf("click!\n");
+ if (++eyes_back >= NUM_DOMINO_X - 1) {
eyes_back = 0;
eyes_front = (eyes_front+1)%NUM_DOMINO_Y;
}
+ printf("%d %d\n", eyes_front, eyes_back);
}
}
@@ -67,8 +68,8 @@ void draw_image(decoded_image img) {
for (int y = 0; y < DOMINO_HEIGHT; y++) {
for (int x = 0; x < DOMINO_WIDTH; x++) {
- img.buf[(b->front.y * 10 + y) * img.width + b->front.x * 10 + x] =
- (*(uint32_t*) &domino[b->front.val][b->back.val][y * DOMINO_WIDTH * BYTES_PER_PIXEL + x * BYTES_PER_PIXEL]);
+ img.buf[(b->front.y * EYE_SIZE + y) * img.width + b->front.x * EYE_SIZE + x] =
+ (*(uint32_t*) &domino[b->back.val][b->front.val][y * DOMINO_WIDTH * BYTES_PER_PIXEL + x * BYTES_PER_PIXEL]);
}
}
}