Improve game map formatting
This commit is contained in:
parent
7178b96077
commit
01ca2f50f4
@ -24,11 +24,37 @@ impl<'a> Widget for GameMapWidget<'a> {
|
||||
for x in 0..(self.rules.map_width + 1) {
|
||||
let o_x = x as u16 * 2;
|
||||
let o_y = y as u16 * 2;
|
||||
buf.get_mut(o_x, o_y).set_symbol(symbols.cross);
|
||||
buf.get_mut(o_x, o_y).set_symbol(match (x, y) {
|
||||
(0, 0) => symbols.top_left,
|
||||
|
||||
(x, 0) if x == self.rules.map_width => symbols.top_right,
|
||||
(0, y) if y == self.rules.map_height => symbols.bottom_left,
|
||||
|
||||
(0, _) => symbols.vertical_right,
|
||||
(_, 0) => symbols.horizontal_down,
|
||||
|
||||
(x, y) if x == self.rules.map_width && y == self.rules.map_height => {
|
||||
symbols.bottom_right
|
||||
}
|
||||
|
||||
(x, _) if x == self.rules.map_width => symbols.vertical_left,
|
||||
(_, y) if y == self.rules.map_height => symbols.horizontal_up,
|
||||
|
||||
_ => symbols.cross,
|
||||
});
|
||||
|
||||
if x < self.rules.map_width {
|
||||
buf.get_mut(o_x + 1, o_y).set_symbol(symbols.horizontal);
|
||||
}
|
||||
|
||||
if y < self.rules.map_height {
|
||||
buf.get_mut(o_x, o_y + 1).set_symbol(symbols.vertical);
|
||||
}
|
||||
|
||||
if x < self.rules.map_width && y < self.rules.map_height {
|
||||
buf.get_mut(o_x + 1, o_y + 1).set_char('.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user