aboutsummaryrefslogtreecommitdiff
path: root/src/tiling.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tiling.rs')
-rw-r--r--src/tiling.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/tiling.rs b/src/tiling.rs
index fbaae40..9bdb071 100644
--- a/src/tiling.rs
+++ b/src/tiling.rs
@@ -1,8 +1,5 @@
extern crate pancurses;
-use pancurses::{Window};
-
-
pub struct TileGrid {
grid: Vec<Vec<TileType>>
}
@@ -39,9 +36,13 @@ impl TileGrid {
pub fn raw_data(& self) -> & Vec<Vec<TileType>> {
&self.grid
}
+
+ pub fn get_block_at(&self, x: usize, y: usize) -> &TileType {
+ &self.grid[y + 1][x]
+ }
}
-fn tile_to_str(tile: &TileType) -> &str {
+pub fn tile_to_str(tile: &TileType) -> &str {
match tile {
TileType::Floor => ".",
TileType::Wall => "#",
@@ -53,10 +54,6 @@ fn tile_to_str(tile: &TileType) -> &str {
}
}
-pub fn draw_block(window: &Window, block: &TileType) {
- window.printw(tile_to_str(block));
-}
-
pub trait Tileable {
fn tile(&self, grid: &mut TileGrid) -> Result<(), String>;
}