From cf138cd9be80abcc9f7cab4c74ad16347fc1d0f3 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Fri, 14 Oct 2022 17:48:14 +0200 Subject: [PATCH] cursor wraps around --- minesweeper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/minesweeper.c b/minesweeper.c index 4fea956..2bea7ed 100644 --- a/minesweeper.c +++ b/minesweeper.c @@ -407,25 +407,25 @@ int32_t minesweeper_app(void* p) { case InputKeyUp: minesweeper_state->cursor_y--; if(minesweeper_state->cursor_y < 0) { - minesweeper_state->cursor_y = 0; + minesweeper_state->cursor_y = PLAYFIELD_HEIGHT - 1; } break; case InputKeyDown: minesweeper_state->cursor_y++; if(minesweeper_state->cursor_y >= PLAYFIELD_HEIGHT) { - minesweeper_state->cursor_y = PLAYFIELD_HEIGHT-1; + minesweeper_state->cursor_y = 0; } break; case InputKeyRight: minesweeper_state->cursor_x++; if(minesweeper_state->cursor_x >= PLAYFIELD_WIDTH) { - minesweeper_state->cursor_x = PLAYFIELD_WIDTH-1; + minesweeper_state->cursor_x = 0; } break; case InputKeyLeft: minesweeper_state->cursor_x--; if(minesweeper_state->cursor_x < 0) { - minesweeper_state->cursor_x = 0; + minesweeper_state->cursor_x = PLAYFIELD_WIDTH-1; } break; case InputKeyOk: