Commit Graph

8 Commits

Author SHA1 Message Date
GarandPLG 923af91aeb Lazy init game states and extract board module
App now stores CLI arguments and an optional GameStates, initializing
the
states lazily on the first window resize. Skirmish board logic is moved
to
a new BoardState module with dedicated helpers (cells_area_helper and
updated cell size handling). Views and keybindings are updated to use
the
optional state accessors.
2026-04-02 00:45:57 +02:00
GarandPLG ba0028b7a7 Refactor keybindings and add validated CLI arguments
Extracted common quit/esc handling into `common_keybindings`. Introduced
`Group::CtrlMovement` for Ctrl‑arrow keys and updated keybinding
definitions.
Removed duplicated quit logic in main_menu and skirmish modules. Bumped
clap to 4.6.0 and updated Cargo.lock. Added range‑checked parsers for
map
size, resources, supply limit, XP modifier and skill points in the CLI.
2026-03-27 20:15:15 +01:00
GarandPLG 0577697059 Replace settings module with skirmish mode
Removed the settings UI and its keybinding logic, added a skirmish view
and corresponding keybindings, simplified the SettingsState to hold
skirmish configuration, updated module exports, and changed the CLI
default map height from 25 to 21. Also fixed the main menu selection
limit.
2026-03-17 14:28:46 +01:00
GarandPLG fd0f6defea Rename GameStates to States and adjust keybindings
Replace the old `GameStates` struct with a new `states` module, rename
the
field in `App` to `states`, and update construction to pass CLI args.
Remove the now‑unused `game_states.rs` file and adjust imports
accordingly.
Update keybinding definitions: change the wildcard symbol to "[All]" and
simplify the wildcard detection logic by dropping the modifiers check.
2026-03-16 10:27:44 +01:00
GarandPLG ef271c0d87 Add Quit2 action bound to Ctrl+C 2026-03-12 16:30:54 +01:00
GarandPLG 71b9d44a77 Refactor keybindings with groups and symbols
Introduce a `Group` enum to categorize actions and add `group` and
`symbol`
fields to `KeyBinding`. Extend `Action` with `Up`, `Down`, `Space`, and
`Esc`, updating all keybinding definitions accordingly.

Update `binding_for_view` to return the new actions per view and handle
`Esc` by returning to the main menu.

Rewrite the keybindings widget as a custom `Widget` that renders grouped
paragraphs with proper layout.

Adjust the main menu layout percentages to accommodate the new widget.
2026-03-12 16:00:45 +01:00
GarandPLG f481f5dc87 Add GameStates, typed enums, and App::new constructor 2026-03-12 00:19:22 +01:00
GarandPLG ec1aa4fbe8 Refactor keybinding handling and update widgets
- Remove the old `keybindings.rs` and stop re‑exporting its symbols.
- Add view‑specific handling: `App::handle_key_event` now delegates to
  `main_menu_keybindings` when the view is `MainMenu`.
- Update imports in `app.rs`, `widget.rs`, and widget modules to use the
  new `app::keybindings` path.
- Enhance `keybindings_widget` to display ↑, ↓ and “Space” for special
  keys.
- Change main menu layout percentages from 90/10 to 87/13.
- Reorder the `clap` import in `cli.rs` for consistency.
2026-03-10 16:29:27 +01:00