Generic grids
[kaka/rust-sdl-test.git] / src / core / level / mod.rs
index b70cdb8..3336b95 100644 (file)
@@ -1,4 +1,4 @@
-use common::Point2D;
+use common::Point;
 use core::render::Renderer;
 use sprites::SpriteManager;
 
@@ -10,13 +10,13 @@ pub use self::lvlgen::LevelGenerator;
 
 #[derive(Default)]
 pub struct Level {
-    pub gravity: Point2D<f64>,
-    pub grid: Grid,
-    walls: Vec<Vec<Point2D<isize>>>,
+    pub gravity: Point<f64>,
+    pub grid: Grid<bool>,
+    walls: Vec<Vec<Point<isize>>>,
 }
 
 impl Level {
-    // pub fn new(gravity: Point2D<f64>) -> Self {
+    // pub fn new(gravity: Point<f64>) -> Self {
     //         let seed = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() as u32;
     //         let mut lvl = Level { gravity, grid: Grid::generate(seed, 10), iterations: 10, walls: vec!() };
     //         lvl.filter_regions();
@@ -48,9 +48,9 @@ impl Level {
 ////////// GRID ////////////////////////////////////////////////////////////////
 
 #[derive(Default)]
-pub struct Grid {
+pub struct Grid<T> {
     pub width: usize,
     pub height: usize,
     pub cell_size: usize,
-    pub cells: Vec<Vec<bool>>,
+    pub cells: Vec<Vec<T>>,
 }