diff options
author | Guillaume Pasquet <dev@etenil.net> | 2019-07-06 23:47:51 +0100 |
---|---|---|
committer | Guillaume Pasquet <dev@etenil.net> | 2019-07-06 23:47:51 +0100 |
commit | b454904e25e587267ffdbac494d99835eb7d13ad (patch) | |
tree | 5504cd98a2532731b569ae3fb4dda0968ed95534 /src/main.rs | |
parent | 9669ad9abcad903fe3d836bf2ca1445fd64e3cba (diff) |
Refactored GameWorld and introduced TileSet
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 7edc654..618327f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,13 +14,13 @@ use pancurses::{Window, initscr, endwin}; use rand::Rng; use std::io; use std::convert::TryFrom; -use world::{World, GameWorld, BlockType}; +use world::{World, GameWorld, TileType}; -fn draw_block(window: &Window, block: &BlockType) { +fn draw_block(window: &Window, block: &TileType) { let repr = match block { - BlockType::Floor => ".", - BlockType::Wall => "0", - BlockType::Nothing => " " + TileType::Floor => ".", + TileType::Wall => "0", + TileType::Empty => " " }; print!("{}", repr); @@ -29,9 +29,9 @@ fn draw_block(window: &Window, block: &BlockType) { } fn render_world(window: &Window, world: &World) { - let grid = world.get_world(); + let grid = world.to_tilegrid(); - for (linenum, line) in grid.iter().enumerate() { + for (linenum, line) in grid.raw_data().iter().enumerate() { for block in line.iter() { draw_block(&window, block); } |