aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Pasquet <guillaume.pasquet@eggplant.io>2019-11-12 10:53:22 +0100
committerGuillaume Pasquet <guillaume.pasquet@eggplant.io>2019-11-12 10:53:22 +0100
commit06dd4ad863d6f77428ad799c4a93ca599ddf9b19 (patch)
tree3b395066e304b48644ac00555c1ae813c1007f13
parentdbb1f294d59211df1ecdece2e2d1ac61f49c144a (diff)
Better debug
-rw-r--r--src/main.rs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 022315c..1b76d47 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,6 +8,7 @@ mod character;
mod computer;
mod world;
+use std::env;
use character::Player;
use character::Character;
use computer::Enemy;
@@ -51,6 +52,7 @@ fn debug_level(level: Level) {
}
}
+
fn main() {
let mut level = 0;
let mut dungeon = Dungeon::new(80, 24, 5);
@@ -69,14 +71,22 @@ fn main() {
);
character.place(start_location);
- dungeon.levels.into_iter().map(debug_level);
-
- // let window = initscr();
+ // Dump the whole dungeon structure in terminal for debugging
+ match env::var("DEBUG") {
+ Ok(_) => {
+ for l in dungeon.levels {
+ debug_level(l);
+ }
+ return
+ },
+ Err(_) => ()
+ };
- // render_dungeon(&window, &world);
+ let window = initscr();
- // window.refresh();
+ render_level(&window, &dungeon.levels[0]);
+ window.refresh();
+ window.getch();
- // window.getch();
- // endwin();
+ endwin();
}