map_gen_2d/
lib.rs

1use std::fmt;
2
3pub mod bsp;
4#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
5pub enum Tile {
6    Floor,
7    Wall
8}
9
10impl fmt::Display for Tile {
11    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12        match self {
13            Tile::Floor => write!(f, "0"),
14            Tile::Wall => write!(f, "1")
15        }
16    }
17}
18#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
19pub struct Point {
20    pub x : usize,
21    pub y : usize,
22}
23
24impl Point {
25    pub fn new(x : usize, y : usize) -> Self {
26        Point {
27            x,
28            y
29        }
30    }
31}
32
33impl fmt::Display for Point {
34    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
35
36        write!(f, "x: {}, y: {}\n", self.x, self.y)?;
37        Ok(())
38    }
39}