Commit Graph

19 Commits

Author SHA1 Message Date
GarandPLG 6dc5f8605c Replace CellTag with CellStructure and embed BaseBuilding
The refactor removes the `Buildings` enum and the `building` module,
replacing
`CellTag` with a new `CellStructure` enum that directly holds a
`BaseBuilding`.
A `get_owner` method is added to `BaseBuilding` to support the new
structure.
All related imports, constructors, and rendering logic are updated to
use
`CellStructure` instead of the old tag and building fields.
2026-04-16 21:56:06 +02:00
GarandPLG 0f60249309 Add BaseBuilding and MinerUnit with UI rendering 2026-04-16 10:59:02 +02:00
GarandPLG be41936f14 Refactor buildings/units, move CellTag & Players
Introduce BaseBuilding struct. Rename Building and Unit to enum types
(Buildings, Units). Move CellTag and Players enums to the skirmish state
module and update imports and re‑exports accordingly. Add placeholder
miner module.
2026-04-15 13:21:39 +02:00
GarandPLG 44d29bd3ad Add Building and Unit structs, extend CellWidget
Introduce empty Building and Unit types and expose them
through new modules. Extend CellWidget to store optional
Unit and Building, update its constructor, and adjust board
rendering to create cells with these new fields (currently always None).
2026-04-13 21:27:44 +02:00
GarandPLG 1393f282e8 Refactor cell marking, add undo, update keybindings
CellWidget::set_selected and set_marked now return &mut Self for method
chaining. Added BoardState::undo_marked_cell to remove the last marked
cell and restore focus. Backspace triggers undo, Delete clears marking.
2026-04-13 16:57:44 +02:00
GarandPLG d5f4d03264 Add toggle_marking and simplify marking logic
Introduce a public `BoardState::toggle_marking` that flips the
marking mode and starts or clears marking accordingly. Refactor
`set_marked_cell` to accept tuple coordinates and clean up its
logic. Update `change_focused_cell` to work with the new signature
and use the toggle helper. Adjust cell display to show coordinates
when a cell is marked.
2026-04-10 21:30:48 +02:00
GarandPLG 869ba0bb7f Add marking mode; rename resize and zoom methods
Introduce a marking mode that lets users toggle cells with Space and
clear
them with Backspace. BoardState now stores `marking_cells` and a list of
`marked_cells` and provides methods to start, clear, and update marks.
CellWidget tracks a `marked` flag and renders marked cells in
LightMagenta.

Keybindings are updated: Space now reads “Marking cells”, Backspace
reads
“Cancel marking”, and the original Enter binding is commented out.

The former `resize_change` and `zoom_change` functions are renamed to
`change_resize` and `change_zoom`; all call sites are updated
accordingly.
2026-04-10 19:06:47 +02:00
GarandPLG b45c300bc3 Add base tags, adjust margins, update CLI defaults
Introduce `CellTag` and `Players` enums and extend `CellWidget` to carry
a tag.
Store player and enemy base coordinates in `BoardState` and tag those
cells.
Reduce horizontal margin from 3 to 1 in board layout helpers.
Change CLI defaults: map width default 42, map height min 11 and default
11.
Adjust offset calculation and render constraints to match the new
layout.
2026-04-09 18:16:26 +02:00
GarandPLG 56bef7c98e Refactor CellWidget constructor to accept selected
Update `CellWidget::new` to take a `selected` flag and remove the
chaining return values from `set_selected` and `set_zoom_level`. The
board code now passes the selection state directly during construction.
2026-04-08 23:43:16 +02:00
GarandPLG 247f5c143b Adjust board vertical offset and focus 2026-04-08 14:51:04 +02:00
GarandPLG e4682f1c52 Refactor board cells to 2D vector and auto‑scroll
Store cells as a nested vector instead of a flat list, simplifying
indexing and
rendering. Add `is_focused_cell_visible` to detect when the focused cell
is
outside the viewport and adjust vertical/horizontal offsets accordingly
in
the skirmish keybindings. Update related methods and widget rendering to
use
the new 2‑D structure.
2026-04-08 14:25:14 +02:00
GarandPLG 4917068fb1 Fix board after resize 2026-04-08 13:24:44 +02:00
GarandPLG 04db2f1daf Make BoardState fields private 2026-04-08 00:08:09 +02:00
GarandPLG 48483da1a4 Refactor skirmish focus handling and CellWidget API
Introduce a MoveFocusedCell enum and a BoardState.change_focused_cell
method to
centralize focus movement logic. Update skirmish keybindings to use this
new
method and simplify board rendering by directly using stored CellWidget
state.
Make CellWidget setters chainable and expose the new enum in the module
re‑exports. Remove duplicated max_offset logic and old move_* methods.
2026-04-07 23:20:11 +02:00
GarandPLG e3fea75983 Add zoom support and emoji keybinding icons
- CellWidget now stores a ZoomLevel, renders size‑dependent text, and
  provides
  methods to set the zoom level and build its block.
- BoardState creates cells with the current zoom level, adds a helper to
  get a
  mutable cell, and updates each cell’s zoom level in `zoom_change`.
- KeybindingsWidget constructor now takes the widget height, calculates
  vertical padding to centre groups, and adds left borders between
  groups.
- Views (default, main_menu, skirmish) pass the area height to the new
  constructor.
- Keybinding descriptions are replaced with emoji symbols (🔈, 🔊, 🔉).
- BoardWidget clones the cell template instead of dereferencing it.
2026-04-07 19:21:43 +02:00
GarandPLG 3f646de3bb Encapsulate cell selection and simplify board rendering 2026-04-07 17:48:05 +02:00
GarandPLG 2b96ec129f Encapsulate FocusedCell fields and add getters 2026-04-07 01:14:36 +02:00
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 c4e28255b6 Move skirmish Offset and FocusedCell to own module
Extract Offset and FocusedCell structs from skirmish.rs into a new
skirmish_states module. Re-export the structs from the top-level states
module and adjust imports in skirmish.rs.
2026-04-01 22:10:25 +02:00