diff options
author | Guillaume Pasquet <guillaume.pasquet@eggplant.io> | 2019-11-12 10:35:27 +0100 |
---|---|---|
committer | Guillaume Pasquet <guillaume.pasquet@eggplant.io> | 2019-11-12 10:35:27 +0100 |
commit | 9f95c253433e84bff929e5f001a919cb84110003 (patch) | |
tree | f70924a2fda57783bc2ac2072f620afe115a4910 /src/main.rs | |
parent | 5f6768b6a7c954d47ef97809f688df83664e85bc (diff) |
up
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index 7da68ed..776e224 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,10 +11,7 @@ mod world; use character::Player; 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 { @@ -31,8 +28,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() { @@ -42,8 +39,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() { @@ -54,14 +51,17 @@ 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(); - debug_world(&world); + for l in dungeon.levels { + debug_level(&l); + } // let window = initscr(); - // render_world(&window, &world); + // render_dungeon(&window, &world); // window.refresh(); |