mazeir/map/orthogonal/
stdout.rs

1use super::{Orthogonal, LEFT_WALL, UP_WALL};
2
3use crate::output::Print;
4use colored::Colorize;
5
6
7impl Print for Orthogonal {
8    fn print(&self) {
9        let space = "  ".on_bright_white();
10        let wall = "  ".on_truecolor(0, 0, 0);
11        for i in 0..self.height {
12            let line = &self.map[self.width * i..self.width * (i + 1)];
13            for v in line.iter() {
14                print!("{}", &wall);
15                print!("{}", if *v & UP_WALL == 0 { &wall } else { &space });
16            }
17            println!("{}", &wall);
18            for v in line.iter() {
19                print!("{}", if *v & LEFT_WALL == 0 { &wall } else { &space });
20                print!("{}", &space);
21            }
22            println!("{}", &wall);
23        }
24        for _ in 0..self.width * 2 + 1 { print!("{}", &wall); }
25    }
26}