diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-17 15:08:59 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-17 15:08:59 -0500 |
| commit | d2521fcb32972e98170bc703984fc5a91f14ccb2 (patch) | |
| tree | 45fd561e3c558246b9dfcdf1bd56e1e7fd64dd44 /game/src/main.rs | |
| parent | wasm: add a default emsdk sysroot for non nixos users (diff) | |
| download | DungeonCrawl-d2521fcb32972e98170bc703984fc5a91f14ccb2.tar.gz DungeonCrawl-d2521fcb32972e98170bc703984fc5a91f14ccb2.tar.bz2 DungeonCrawl-d2521fcb32972e98170bc703984fc5a91f14ccb2.zip | |
wasm: add options for logs, debug, and seed
Diffstat (limited to 'game/src/main.rs')
| -rw-r--r-- | game/src/main.rs | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/game/src/main.rs b/game/src/main.rs index a44f317..1ab49fe 100644 --- a/game/src/main.rs +++ b/game/src/main.rs @@ -1,49 +1,29 @@ -#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] -mod arch { - use argh::FromArgs; - use game::Game; - use graphics::WindowBuilder; +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(()) - } -} - -#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))] -mod arch { - use game::Game; - use graphics::WindowBuilder; - - pub fn main() -> graphics::Result<()> { - // Load the window - let window = WindowBuilder::new().build()?; - Game::new(window, None).run(); - Ok(()) - } +/// 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<()> { - arch::main() + // 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(()) } |