From ec671aa9b56c53d76ce310f0772ee05c97064d3f Mon Sep 17 00:00:00 2001 From: Guillaume Pasquet Date: Tue, 12 Nov 2019 11:59:03 +0100 Subject: Dynamic terminal size. --- src/main.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index 49e8a8c..c4c6f4f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,8 +55,14 @@ fn debug_level(level: Level) { fn main() { + let window = initscr(); let mut level = 0; - let mut dungeon = Dungeon::new(80, 24, 5); + + let mut dungeon = Dungeon::new( + window.get_max_x() as usize, + window.get_max_y() as usize - 2, + 5 + ); dungeon.generate(); let start_location = dungeon.levels[0].get_start_point(); @@ -72,19 +78,6 @@ fn main() { ); character.place(start_location); - // Dump the whole dungeon structure in terminal for debugging - match env::var("DEBUG") { - Ok(_) => { - for l in dungeon.levels { - debug_level(l); - } - return - }, - Err(_) => () - }; - - let window = initscr(); - render_level(&window, &dungeon.levels[0]); window.keypad(true); -- cgit v1.2.3