generated from GarandPLG/rust-flake-template
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.
This commit is contained in:
1 parent
6e6181887c
commit
b45c300bc3
6 files changed
+97
-44
No files matched your search
@@ -89,11 +89,22 @@ pub fn skirmish_view(app: &App, area: Rect, buf: &mut Buffer) {
|
||||
board_block.render(main_area, buf);
|
||||
|
||||
let cells_area: Rect = board_area.inner(Margin {
|
||||
horizontal: 3,
|
||||
horizontal: 1,
|
||||
vertical: 1,
|
||||
});
|
||||
|
||||
BoardWidget::new(&states.skirmish.board).render(cells_area, buf);
|
||||
// TODO: add actual (effective) board sizes as Constraints
|
||||
BoardWidget::new(&states.skirmish.board).render(
|
||||
cells_area.centered(
|
||||
Constraint::Length(
|
||||
(states.skirmish.board.cell_width * states.skirmish.board.cols) as u16,
|
||||
),
|
||||
Constraint::Length(
|
||||
(states.skirmish.board.cell_height * states.skirmish.board.rows) as u16,
|
||||
),
|
||||
),
|
||||
buf,
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user