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.
This commit is contained in:
2026-03-26 11:05:43 +01:00
parent 0577697059
commit cc179cee03
9 changed files with 205 additions and 15 deletions
+35
View File
@@ -0,0 +1,35 @@
use ratatui::{
buffer::Buffer,
layout::{Alignment, Rect},
style::Stylize,
widgets::{Block, Borders, Paragraph, Widget},
};
// pub enum CellTags {
// Player,
// Enemy,
// Dirt,
// Tunnel,
// Base,
// }
pub struct CellWidget {
pub row: usize,
pub col: usize,
// pub tags: Vec<CellTags>,
}
impl CellWidget {
pub fn new(row: usize, col: usize) -> Self {
Self { row, col }
}
}
impl Widget for CellWidget {
fn render(self, area: Rect, buf: &mut Buffer) {
Paragraph::new(format!("{}/{}", self.row, self.col))
.alignment(Alignment::Center)
.block(Block::default().borders(Borders::ALL).white())
.render(area, buf);
}
}