diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index 523ef13..022315c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,10 +12,7 @@ use character::Player; use character::Character; use computer::Enemy; use pancurses::{Window, initscr, endwin}; -use rand::Rng; -use std::io; -use std::convert::TryFrom; -use world::{World, GameWorld, TileType}; +use world::{Dungeon, Level, Generable, TileType}; fn tile_to_str(tile: &TileType) -> &str { match tile { @@ -32,8 +29,8 @@ fn draw_block(window: &Window, block: &TileType) { window.printw(tile_to_str(block)); } -fn render_world(window: &Window, world: &World) { - let grid = world.to_tilegrid().unwrap(); +fn render_level(window: &Window, level: &Level) { + let grid = level.to_tilegrid().unwrap(); for (linenum, line) in grid.raw_data().iter().enumerate() { for block in line.iter() { @@ -43,8 +40,8 @@ fn render_world(window: &Window, world: &World) { } } -fn debug_world(world: &World) { - let grid = world.to_tilegrid().unwrap(); +fn debug_level(level: Level) { + let grid = level.to_tilegrid().unwrap(); for line in grid.raw_data().iter() { for block in line.iter() { @@ -55,10 +52,11 @@ fn debug_world(world: &World) { } fn main() { - let mut world = World::new(80, 24); - world.generate(); + let mut level = 0; + let mut dungeon = Dungeon::new(80, 24, 5); + dungeon.generate(); - let start_location = world.get_start_location(); + let start_location = dungeon.levels[0].get_start_point(); let mut character: Character = Character::new( "Kshar".to_string(), @@ -71,11 +69,11 @@ fn main() { ); character.place(start_location); - debug_world(&world); + dungeon.levels.into_iter().map(debug_level); // let window = initscr(); - // render_world(&window, &world); + // render_dungeon(&window, &world); // window.refresh(); |