generated from GarandPLG/rust-flake-template
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.
This commit is contained in:
1 parent
c4e28255b6
commit
923af91aeb
15 files changed
+228
-178
No files matched your search
@@ -0,0 +1,15 @@
|
||||
use crate::app::views::skirmish_layout;
|
||||
use ratatui::{
|
||||
layout::{Margin, Rect},
|
||||
widgets::{Block, Borders},
|
||||
};
|
||||
|
||||
pub fn cells_area_helper(area: &Rect) -> Rect {
|
||||
Block::new()
|
||||
.borders(Borders::LEFT | Borders::TOP | Borders::RIGHT)
|
||||
.inner(skirmish_layout(*area)[1])
|
||||
.inner(Margin {
|
||||
horizontal: 3,
|
||||
vertical: 1,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user