main.rs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. extern crate argparse;
  2. extern crate simplelog;
  3. mod config;
  4. mod board;
  5. mod util;
  6. mod grid;
  7. #[macro_use] extern crate log;
  8. use self::argparse::{ArgumentParser, Store};
  9. use simplelog::{CombinedLogger,WriteLogger, LevelFilter, Config};
  10. use std::fs::File;
  11. fn main() {
  12. // Logging
  13. CombinedLogger::init(vec![WriteLogger::new(LevelFilter::Trace, Config::default(), File::create("fallout-terminal.log").unwrap())]).unwrap();
  14. // Argument handling
  15. let mut config_location = config::default_config_file();
  16. let config_help = format!("Config file location, default {}", config_location);
  17. {
  18. let mut ap = ArgumentParser::new();
  19. ap.set_description("A Fallout terminal minigame inspired game.");
  20. ap.refer(&mut config_location)
  21. .add_option(
  22. &["--config"],
  23. Store,
  24. config_help.as_str()
  25. );
  26. ap.parse_args_or_exit();
  27. }
  28. // Config file handling
  29. if config_location == "" {
  30. panic!("No default config file found, and no config file path specified")
  31. }
  32. let conf = config::load_config_file(config_location);
  33. let mut screen = board::Screen::new(&conf);
  34. screen.intro();
  35. screen.w.clear();
  36. screen.initialize_game(conf);
  37. }