Prepare next task
This commit is contained in:
parent
aea9175b7e
commit
b7d2cceff6
@ -81,6 +81,7 @@ fn ui<B: Backend>(f: &mut Frame<B>, model: &mut SetBotsLayoutScreen, rules: &Gam
|
||||
.set_default_empty_char(' ')
|
||||
.add_colored_cells(current_boat)
|
||||
.add_colored_cells(other_boats)
|
||||
.set_title("Now, configure your boats")
|
||||
.set_legend(
|
||||
"n next boat \n\
|
||||
r rotate boat \n\n\
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user