Fix numpad navigation for Mac

This commit is contained in:
Timothy Warren 2021-11-04 09:25:07 -04:00
parent c6abd497a1
commit cfd2ed887a

View File

@ -63,35 +63,35 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState {
VirtualKeyCode::Left VirtualKeyCode::Left
| VirtualKeyCode::Numpad4 | VirtualKeyCode::Numpad4
| VirtualKeyCode::H | VirtualKeyCode::H
| VirtualKeyCode::A => try_move_player(-1, 0, &mut gs.ecs), | VirtualKeyCode::Key4 => try_move_player(-1, 0, &mut gs.ecs),
VirtualKeyCode::Right VirtualKeyCode::Right
| VirtualKeyCode::Numpad6 | VirtualKeyCode::Numpad6
| VirtualKeyCode::L | VirtualKeyCode::L
| VirtualKeyCode::D => try_move_player(1, 0, &mut gs.ecs), | VirtualKeyCode::Key6 => try_move_player(1, 0, &mut gs.ecs),
VirtualKeyCode::Up VirtualKeyCode::Up
| VirtualKeyCode::Numpad8 | VirtualKeyCode::Numpad8
| VirtualKeyCode::K | VirtualKeyCode::K
| VirtualKeyCode::W => try_move_player(0, -1, &mut gs.ecs), | VirtualKeyCode::Key8 => try_move_player(0, -1, &mut gs.ecs),
VirtualKeyCode::Down VirtualKeyCode::Down
| VirtualKeyCode::Numpad2 | VirtualKeyCode::Numpad2
| VirtualKeyCode::J | VirtualKeyCode::J
| VirtualKeyCode::S | VirtualKeyCode::S
| VirtualKeyCode::X => try_move_player(0, 1, &mut gs.ecs), | VirtualKeyCode::Key2 => try_move_player(0, 1, &mut gs.ecs),
// Diagonals // Diagonals
VirtualKeyCode::Numpad9 | VirtualKeyCode::Y | VirtualKeyCode::E => { VirtualKeyCode::Numpad9 | VirtualKeyCode::Y | VirtualKeyCode::Key9 => {
try_move_player(1, -1, &mut gs.ecs) try_move_player(1, -1, &mut gs.ecs)
} }
VirtualKeyCode::Numpad7 | VirtualKeyCode::U | VirtualKeyCode::Q => { VirtualKeyCode::Numpad7 | VirtualKeyCode::U | VirtualKeyCode::Key7 => {
try_move_player(-1, -1, &mut gs.ecs) try_move_player(-1, -1, &mut gs.ecs)
} }
VirtualKeyCode::Numpad3 | VirtualKeyCode::N | VirtualKeyCode::C => { VirtualKeyCode::Numpad3 | VirtualKeyCode::N | VirtualKeyCode::Key3 => {
try_move_player(1, 1, &mut gs.ecs) try_move_player(1, 1, &mut gs.ecs)
} }
VirtualKeyCode::Numpad1 | VirtualKeyCode::B | VirtualKeyCode::Z => { VirtualKeyCode::Numpad1 | VirtualKeyCode::B | VirtualKeyCode::Key1 => {
try_move_player(-1, 1, &mut gs.ecs) try_move_player(-1, 1, &mut gs.ecs)
} }