aboutsummaryrefslogtreecommitdiff
path: root/flip.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-08-09 20:38:39 +0100
committerBen Harris <bjh21@bjh21.me.uk>2023-08-13 16:44:24 +0100
commit4e724b25c276ec84ce5c95041c0cb3c0256fa388 (patch)
tree8371b3c6a7706181ac26215300fc38ed0dce4434 /flip.c
parent2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5 (diff)
downloadpuzzles-4e724b25c276ec84ce5c95041c0cb3c0256fa388.zip
puzzles-4e724b25c276ec84ce5c95041c0cb3c0256fa388.tar.gz
puzzles-4e724b25c276ec84ce5c95041c0cb3c0256fa388.tar.bz2
puzzles-4e724b25c276ec84ce5c95041c0cb3c0256fa388.tar.xz
Flip: use move_cursor() for cursor movement
Diffstat (limited to 'flip.c')
-rw-r--r--flip.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/flip.c b/flip.c
index 1efacf8..044d6c3 100644
--- a/flip.c
+++ b/flip.c
@@ -982,22 +982,9 @@ static char *interpret_move(const game_state *state, game_ui *ui,
return MOVE_NO_EFFECT;
}
}
- }
- else if (IS_CURSOR_MOVE(button)) {
- int dx = 0, dy = 0;
- switch (button) {
- case CURSOR_UP: dy = -1; break;
- case CURSOR_DOWN: dy = 1; break;
- case CURSOR_RIGHT: dx = 1; break;
- case CURSOR_LEFT: dx = -1; break;
- default: assert(!"shouldn't get here");
- }
- ui->cx += dx; ui->cy += dy;
- ui->cx = min(max(ui->cx, 0), state->w - 1);
- ui->cy = min(max(ui->cy, 0), state->h - 1);
- ui->cdraw = true;
- nullret = MOVE_UI_UPDATE;
- }
+ } else if (IS_CURSOR_MOVE(button))
+ nullret = move_cursor(button, &ui->cx, &ui->cy, state->w, state->h,
+ false, &ui->cdraw);
return nullret;
}