summaryrefslogtreecommitdiff
path: root/game/src/main.rs
blob: 1ab49fe19f573c6d813cca8af46a931ad82aeef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use argh::FromArgs;
use game::Game;
use graphics::WindowBuilder;

/// Play a dungeon crawl game
#[derive(FromArgs)]
struct Args {
	/// enable vsync
	#[argh(switch)]
	vsync: bool,
	/// enable verbose logging
	#[argh(switch, short = 'v')]
	verbose: bool,
	/// set the map seed
	#[argh(option)]
	seed: Option<u64>,
}

pub fn main() -> graphics::Result<()> {
	// Parse arguments
	let args: Args = argh::from_env();
	// Load the window
	let window = WindowBuilder::new()
		.vsync(args.vsync)
		.verbose(args.verbose)
		.build()?;
	Game::new(window, args.seed).run();
	Ok(())
}