abstreet/game/src/main.rs

50 lines
1.2 KiB
Rust
Raw Normal View History

2019-06-22 22:26:52 +03:00
mod abtest;
mod challenges;
mod common;
2019-06-22 19:48:42 +03:00
mod debug;
2019-06-22 21:03:37 +03:00
mod edit;
mod game;
mod helpers;
2019-06-22 23:01:42 +03:00
mod mission;
mod render;
mod sandbox;
mod splash_screen;
2019-06-22 23:45:05 +03:00
mod tutorial;
mod ui;
2019-09-19 03:29:34 +03:00
use crate::ui::Flags;
use abstutil::CmdArgs;
use sim::SimFlags;
fn main() {
2019-09-19 03:29:34 +03:00
let mut args = CmdArgs::new();
// TODO Lift this out of the game crate entirely.
if args.enabled("--prebake") {
challenges::prebake();
return;
}
2019-09-19 03:29:34 +03:00
let mut flags = Flags {
sim_flags: SimFlags::from_args(&mut args),
kml: args.optional("--kml"),
draw_lane_markings: !args.enabled("--dont_draw_lane_markings"),
2019-09-19 20:42:16 +03:00
num_agents: args.optional_parse("--num_agents", |s| s.parse()),
textures: args.enabled("--textures"),
dev: args.enabled("--dev"),
2019-09-19 03:29:34 +03:00
};
if flags.dev {
2019-09-19 03:29:34 +03:00
flags.sim_flags.rng_seed = Some(42);
}
let mut settings = ezgui::Settings::new("A/B Street", (1800.0, 800.0));
if args.enabled("--enable_profiler") {
settings.enable_profiling();
}
2019-10-07 20:39:09 +03:00
if let Some(n) = args.optional_parse("--font_size", |s| s.parse::<usize>()) {
settings.default_font_size(n);
}
2019-09-19 03:29:34 +03:00
args.done();
ezgui::run(settings, |ctx| game::Game::new(flags, ctx));
}