From 8bccbf144822fd9ab7824f93781bc6979d8c2c69 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 5 Jul 2026 21:25:03 -0700 Subject: [PATCH] Add WASD as alternate movement/menu keys --- src/bin/terminal/input.rs | 28 ++++++++++++++-------------- src/bin/terminal/ui.rs | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bin/terminal/input.rs b/src/bin/terminal/input.rs index 4bd0910..862d851 100644 --- a/src/bin/terminal/input.rs +++ b/src/bin/terminal/input.rs @@ -58,8 +58,8 @@ pub fn handle_key( // Research menu keys if research_menu { return match key.code { - KeyCode::Up | KeyCode::Char('k') => Some(Command::ResearchUp), - KeyCode::Down | KeyCode::Char('j') => Some(Command::ResearchDown), + KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('w') => Some(Command::ResearchUp), + KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('s') => Some(Command::ResearchDown), KeyCode::Enter => Some(Command::ResearchBuy), KeyCode::Esc => Some(Command::ResearchClose), _ => None, @@ -69,8 +69,8 @@ pub fn handle_key( // Hire menu keys if hire_menu { return match key.code { - KeyCode::Up | KeyCode::Char('k') => Some(Command::HireUp), - KeyCode::Down | KeyCode::Char('j') => Some(Command::HireDown), + KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('w') => Some(Command::HireUp), + KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('s') => Some(Command::HireDown), KeyCode::Enter => Some(Command::HireSelect), KeyCode::Esc | KeyCode::Char('f') => Some(Command::HireClose), KeyCode::Char('q') => Some(Command::Quit), @@ -81,8 +81,8 @@ pub fn handle_key( // World map keys if world_map { return match key.code { - KeyCode::Up | KeyCode::Char('k') => Some(Command::WorldMapUp), - KeyCode::Down | KeyCode::Char('j') => Some(Command::WorldMapDown), + KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('w') => Some(Command::WorldMapUp), + KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('s') => Some(Command::WorldMapDown), KeyCode::Enter => Some(Command::WorldMapSelect), KeyCode::Esc | KeyCode::Char('m') => Some(Command::WorldMapClose), KeyCode::Char('q') => Some(Command::Quit), @@ -93,10 +93,10 @@ pub fn handle_key( // Build mode keys if build_mode { return match key.code { - KeyCode::Up | KeyCode::Char('k') => Some(Command::CursorUp), - KeyCode::Down | KeyCode::Char('j') => Some(Command::CursorDown), - KeyCode::Left => Some(Command::CursorLeft), - KeyCode::Right | KeyCode::Char('l') => Some(Command::CursorRight), + KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('w') => Some(Command::CursorUp), + KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('s') => Some(Command::CursorDown), + KeyCode::Left | KeyCode::Char('h') | KeyCode::Char('a') => Some(Command::CursorLeft), + KeyCode::Right | KeyCode::Char('l') | KeyCode::Char('d') => Some(Command::CursorRight), KeyCode::Tab => Some(Command::CycleCategory), KeyCode::Char('n') => Some(Command::CycleItemNext), KeyCode::Char('p') => Some(Command::CycleItemPrev), @@ -124,10 +124,10 @@ pub fn handle_key( // Normal keys — time always flows, so movement, powers, and time // controls are all available together. match key.code { - KeyCode::Up | KeyCode::Char('k') => Some(Command::MoveUp), - KeyCode::Down | KeyCode::Char('j') => Some(Command::MoveDown), - KeyCode::Left | KeyCode::Char('h') => Some(Command::MoveLeft), - KeyCode::Right | KeyCode::Char('l') => Some(Command::MoveRight), + KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('w') => Some(Command::MoveUp), + KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('s') => Some(Command::MoveDown), + KeyCode::Left | KeyCode::Char('h') | KeyCode::Char('a') => Some(Command::MoveLeft), + KeyCode::Right | KeyCode::Char('l') | KeyCode::Char('d') => Some(Command::MoveRight), KeyCode::Char('b') => Some(Command::EnterBuild), KeyCode::Char('r') => Some(Command::OpenResearch), KeyCode::Char('f') => Some(Command::OpenHireMenu), diff --git a/src/bin/terminal/ui.rs b/src/bin/terminal/ui.rs index 023d927..35d6b34 100644 --- a/src/bin/terminal/ui.rs +++ b/src/bin/terminal/ui.rs @@ -1028,7 +1028,7 @@ impl UI { let tagline = "Build. Scheme. Dominate."; let prompt = "Press any key to start"; let controls = [ - "Move: hjkl/arrows Build: b Research: r Hire: f", + "Move: WASD/arrows Build: b Research: r Hire: f", "Schemes: m Pause: Space/p Speed: +/- Quit: q", ]; -- 2.51.2