Commit Graph

31 Commits

Author SHA1 Message Date
GarandPLG a0186ea0cb Add optional file logging and fix board offsets
Introduce --log CLI flag to enable logging to
war_in_tunnels.log via simplelog.
2026-03-27 18:28:16 +01:00
GarandPLG b71130d3d6 Increase board cell dimensions
Double the height from 4 to 8 and the width from 7 to 14 to improve
readability of the board display.
2026-03-27 16:58:22 +01:00
GarandPLG 5a40760151 Replace scrollbar state with simple offset struct
Introduce Offset type to track scroll positions and replace
ScrollbarState fields in SkirmishState
Update keybindings, App::draw, Widget impl, and BoardWidget::new
to use mutable references and the new Offset struct.
Adjust imports accordingly.
2026-03-26 21:50:39 +01:00
GarandPLG cc179cee03 Add scrolling actions and board widget
Introduce directional and scroll actions, update keybindings, add
scrollbar
state to SkirmishState, and render the board with a new BoardWidget.
Adjust CLI
defaults and layout heights accordingly.
2026-03-26 11:05:43 +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 aaa2c90426 Refactor gaamestates 2026-03-16 21:58:43 +01:00
GarandPLG 53a713b5ea Refactor settings UI and add typed option handling
- Rename `GameMode::Frontlines` to `FrontLines`.
- Introduce `SettingsValue` enum and `SettingsOption` vector for
  typed settings.
- Implement `Display` for `SettingsValue`, `GameMode`, and
  `PerkDecks`.
- Enhance settings keybindings: navigation with Up/Down, value
  parsing on Enter, and error messages.
- Update settings view to render options list, selection marker,
  and popup with error feedback.
- Restyle main menu selector and keybindings widget title.
- Add required imports and minor layout adjustments.
2026-03-16 21:42:08 +01:00
GarandPLG 1d8d1eed46 Rename GameSettingsState to SettingsOptions 2026-03-16 10:45:14 +01:00
GarandPLG aacdacadd5 Extract GameSettingsState and tweak popup layout
The settings model now separates generic settings from game‑specific
fields by
introducing `GameSettingsState`. All game‑related fields are moved into
this
struct and `SettingsState` now holds a `game_settings` field.
Initialization in
`GameStates::new` is updated accordingly. The UI popup is rendered
directly
with added padding and a resized rectangle, and the unused `popup_area`
variable is removed.
2026-03-16 10:42:58 +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 2dbe378470 Add text input handling to settings popup
Introduce a `selected_setting_new_value` field in `SettingsState` and
initialize it.
Add `Backspace` and `WildCard(char)` actions with an `Input` group, and
corresponding keybindings.
Update `event_to_action` to map wildcard characters to
`Action::WildCard`.
Handle backspace and character input in `settings_keybindings` to edit
the new field.
Display the edited value in the settings popup and include the new
actions in the UI.
2026-03-15 22:37:11 +01:00
GarandPLG 9d4ff19b6e KeybindingsWidget now accepts actions
Views now pass a list of `Action` values to `KeybindingsWidget` instead
of
pre‑resolved `KeyBinding` references. The widget resolves the bindings
internally using `binding_for`, simplifying import statements and view
logic.
2026-03-15 22:00:00 +01:00
GarandPLG acc6ba08f3 Add popup toggle to settings view
Introduce `show_popup` flag in SettingsState, toggle it with the Space
key, and
render a yellow test popup in the settings view when the flag is true.
2026-03-14 20:35:03 +01:00
GarandPLG 3d0aa42d7d Adopt clap::ValueEnum for Group and tidy menu view
- Derive `ValueEnum` for `Group` and remove its custom `iter` method.
- Update keybindings widget to use `Group::value_variants()` and adjust
  containment and filtering logic.
- Replace view option generation with a `format_view_string` helper that
  inserts a space before the second capital letter, eliminating the
  previous filter for “MAIN MENU”.
- Adjust imports to include `clap::ValueEnum` where needed.
2026-03-14 20:13:41 +01:00
GarandPLG 61e9dedfe8 Refactor view handling and keybinding API
Move the `View` enum to a dedicated module and implement `Widget` for
`&App` there.
Rename `default_view_keybindings` to `default_keybindings` and adjust
its
signature. Redesign `KeybindingsWidget` to accept an explicit list of
bindings instead of a `View`. Update imports, function signatures, and
rendering
logic across the codebase to reflect these changes.
2026-03-13 20:10:49 +01:00
GarandPLG d563bbc966 Add Settings view, widget, and keybindings
Introduce Settings view handling in key events and widgets.
Add `Enter` action with its keybinding.
Refactor keybinding lookup to use `Option<&KeyBinding>` for missing
entries.
Update view option generation to safely filter possible values.
Export `settings_keybindings` and `settings_widget` from their modules.
2026-03-13 09:31:55 +01:00
GarandPLG 7226a09bb4 Extract default view keybindings and widget
Move generic view rendering and keybinding logic into a new default
module and
replace inline implementations with calls to the new helpers.
2026-03-12 23:06:55 +01:00
GarandPLG 70a8ac348e Refactor keybindings widget and reorder Group enum
- Introduce `KeybindingsWidget::new(view)` constructor and remove the
  standalone `keybindings_widget` function.
- Update all imports and call sites to use `KeybindingsWidget` directly.
- Reorder `Group` enum to place `Quit` after `Select` and adjust its
  iterator accordingly.
2026-03-12 22:47:22 +01:00
GarandPLG 073e70441f Add group filtering and layout for keybindings UI
Return the set of used groups from `binding_for_view` and adjust
`keybindings_widget` to render only those groups. Introduce a vertical
layout in the main widget to display a placeholder paragraph above
the keybindings area, and update imports and border logic accordingly.
2026-03-12 17:31:31 +01:00
GarandPLG 8b7c2c55ce Extract keybinding handling to separate module 2026-03-12 16:37:52 +01:00
GarandPLG ef271c0d87 Add Quit2 action bound to Ctrl+C 2026-03-12 16:30:54 +01:00
GarandPLG c3886ca0cf Add resize handling and non-blocking input loop
Use `recv_timeout` to prevent UI blocking, forward terminal resize
events,
adjust keybinding width calculation, and replace percentage layout with
fill/length for the main menu.
2026-03-12 16:23: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
GarandPLG de42569a51 Refactor to View enum and add keybindings
Replace the `default_window` string field with a `View` enum throughout
the
application. Introduce a new keybinding module providing `Action`,
`KeyBinding` structs and helper functions, and integrate a keybindings
widget
into the main menu. Update the CLI to accept a `View` value enum and
adjust
imports and event handling accordingly. Add a release profile in
`Cargo.toml` with LTO, single codegen unit, higher optimisation level
and
binary stripping for smaller, faster builds.
2026-03-10 14:26:18 +01:00
GarandPLG 64eb906b5f Drop crossterm delete App add CLI defaults
Remove the crossterm dependency and its input handling, delete the
now‑unused
App module, and provide default values for all command‑line options.
2026-03-09 19:53:31 +01:00
GarandPLG a9b84bbe0f Add comprehensive CLI options for game settings
- Expanded `Cli` with arguments for username, game mode, map size, perk
  deck, resources, supply limit, XP modifier, and skill points limit.
- Enabled the `cli` module in `lib.rs` and activated argument parsing in
  `main.rs`.
- Added placeholder (commented) fields to `App` for future configuration
  integration.
2026-03-09 16:54:10 +01:00
GarandPLG e98f1ddc24 dodanie draftów ui 2026-03-06 10:08:31 +01:00
GarandPLG 17e00610a7 init 2026-03-02 17:46:35 +01:00
GarandPLG 1575ff81c1 Initial commit 2026-03-02 16:15:20 +00:00