diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-08-12 13:34:40 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-08-13 16:44:24 +0100 |
| commit | f8c2477ccbe2e86af2dba2c8483b7655d06652ec (patch) | |
| tree | c56d539dc2b083902d7ec36438eefb96501c6673 | |
| parent | 568c22210611f369e11b9348a6e1145bba9c6ee7 (diff) | |
| download | puzzles-f8c2477ccbe2e86af2dba2c8483b7655d06652ec.zip puzzles-f8c2477ccbe2e86af2dba2c8483b7655d06652ec.tar.gz puzzles-f8c2477ccbe2e86af2dba2c8483b7655d06652ec.tar.bz2 puzzles-f8c2477ccbe2e86af2dba2c8483b7655d06652ec.tar.xz | |
Twiddle: use move_cursor() for cursor movement
| -rw-r--r-- | twiddle.c | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -666,18 +666,9 @@ static char *interpret_move(const game_state *state, game_ui *ui, button = button & (~MOD_MASK | MOD_NUM_KEYPAD); - if (IS_CURSOR_MOVE(button)) { - if (button == CURSOR_LEFT && ui->cur_x > 0) - ui->cur_x--; - if (button == CURSOR_RIGHT && (ui->cur_x+n) < (w)) - ui->cur_x++; - if (button == CURSOR_UP && ui->cur_y > 0) - ui->cur_y--; - if (button == CURSOR_DOWN && (ui->cur_y+n) < (h)) - ui->cur_y++; - ui->cur_visible = true; - return MOVE_UI_UPDATE; - } + if (IS_CURSOR_MOVE(button)) + return move_cursor(button, &ui->cur_x, &ui->cur_y, w-n+1, h-n+1, + false, &ui->cur_visible); if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { /* |