Add mouse interaction

This commit is contained in:
2022-10-07 19:57:55 +02:00
parent 13fa2ef87d
commit a2c9e4e257
3 changed files with 69 additions and 18 deletions

View File

@ -18,12 +18,7 @@ pub enum BoatDirection {
BottomRight,
}
const _BOATS_DIRECTION: [BoatDirection; 4] = [
BoatDirection::Left,
BoatDirection::Right,
BoatDirection::Up,
BoatDirection::Down,
];
const _BOATS_DIRECTION: [BoatDirection; 2] = [BoatDirection::Right, BoatDirection::Down];
const _ALL_DIRECTIONS: [BoatDirection; 8] = [
BoatDirection::Left,
@ -54,8 +49,8 @@ impl BoatDirection {
pub fn shift_coordinates(&self, coordinates: Coordinates, nth: usize) -> Coordinates {
let shift = match self {
BoatDirection::Left => (1, 0),
BoatDirection::Right => (-1, 0),
BoatDirection::Left => (-1, 0),
BoatDirection::Right => (1, 0),
BoatDirection::Up => (0, -1),
BoatDirection::Down => (0, 1),
BoatDirection::UpLeft => (-1, -1),