12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- extern crate argparse;
- extern crate simplelog;
- mod config;
- mod board;
- mod util;
- mod grid;
- #[macro_use] extern crate log;
- use self::argparse::{ArgumentParser, Store};
- use simplelog::{CombinedLogger,WriteLogger, LevelFilter, Config};
- use std::fs::File;
- fn main() {
- // Logging
- CombinedLogger::init(vec![WriteLogger::new(LevelFilter::Trace, Config::default(), File::create("fallout-terminal.log").unwrap())]).unwrap();
- // Argument handling
- let mut config_location = config::default_config_file();
- let config_help = format!("Config file location, default {}", config_location);
- {
- let mut ap = ArgumentParser::new();
- ap.set_description("A Fallout terminal minigame inspired game.");
- ap.refer(&mut config_location)
- .add_option(
- &["--config"],
- Store,
- config_help.as_str()
- );
- ap.parse_args_or_exit();
- }
- // Config file handling
- if config_location == "" {
- panic!("No default config file found, and no config file path specified")
- }
- let conf = config::load_config_file(config_location);
- let mut screen = board::Screen::new(&conf);
- screen.intro();
- screen.w.clear();
- screen.initialize_game(conf);
- }
|