mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 15:41:30 -07:00
Flip: use move_cursor() for cursor movement
This commit is contained in:
19
flip.c
19
flip.c
@ -982,22 +982,9 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
|||||||
return MOVE_NO_EFFECT;
|
return MOVE_NO_EFFECT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (IS_CURSOR_MOVE(button))
|
||||||
else if (IS_CURSOR_MOVE(button)) {
|
nullret = move_cursor(button, &ui->cx, &ui->cy, state->w, state->h,
|
||||||
int dx = 0, dy = 0;
|
false, &ui->cdraw);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullret;
|
return nullret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user