Skip to content

Commit cf138cd

Browse files
committed
cursor wraps around
1 parent dc2c8d5 commit cf138cd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

minesweeper.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,25 +407,25 @@ int32_t minesweeper_app(void* p) {
407407
case InputKeyUp:
408408
minesweeper_state->cursor_y--;
409409
if(minesweeper_state->cursor_y < 0) {
410-
minesweeper_state->cursor_y = 0;
410+
minesweeper_state->cursor_y = PLAYFIELD_HEIGHT - 1;
411411
}
412412
break;
413413
case InputKeyDown:
414414
minesweeper_state->cursor_y++;
415415
if(minesweeper_state->cursor_y >= PLAYFIELD_HEIGHT) {
416-
minesweeper_state->cursor_y = PLAYFIELD_HEIGHT-1;
416+
minesweeper_state->cursor_y = 0;
417417
}
418418
break;
419419
case InputKeyRight:
420420
minesweeper_state->cursor_x++;
421421
if(minesweeper_state->cursor_x >= PLAYFIELD_WIDTH) {
422-
minesweeper_state->cursor_x = PLAYFIELD_WIDTH-1;
422+
minesweeper_state->cursor_x = 0;
423423
}
424424
break;
425425
case InputKeyLeft:
426426
minesweeper_state->cursor_x--;
427427
if(minesweeper_state->cursor_x < 0) {
428-
minesweeper_state->cursor_x = 0;
428+
minesweeper_state->cursor_x = PLAYFIELD_WIDTH-1;
429429
}
430430
break;
431431
case InputKeyOk:

0 commit comments

Comments
 (0)