Prepare next task
This commit is contained in:
@ -18,6 +18,7 @@ pub struct GameMapWidget<'a> {
|
||||
rules: &'a GameRules,
|
||||
default_empty_character: char,
|
||||
colored_cells: Vec<ColoredCells>,
|
||||
title: Option<String>,
|
||||
legend: Option<String>,
|
||||
}
|
||||
|
||||
@ -27,6 +28,7 @@ impl<'a> GameMapWidget<'a> {
|
||||
rules,
|
||||
default_empty_character: '.',
|
||||
colored_cells: vec![],
|
||||
title: None,
|
||||
legend: None,
|
||||
}
|
||||
}
|
||||
@ -41,6 +43,11 @@ impl<'a> GameMapWidget<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_title<D: Display>(mut self, title: D) -> Self {
|
||||
self.title = Some(title.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_legend<D: Display>(mut self, legend: D) -> Self {
|
||||
self.legend = Some(legend.to_string());
|
||||
self
|
||||
@ -70,6 +77,8 @@ impl<'a> Widget for GameMapWidget<'a> {
|
||||
|
||||
let symbols = BorderType::line_symbols(BorderType::Plain);
|
||||
|
||||
// TODO : render title
|
||||
|
||||
// Paint game grid
|
||||
for y in 0..(self.rules.map_height + 1) {
|
||||
if y < self.rules.map_height {
|
||||
|
Reference in New Issue
Block a user