acutally read the options from structopt
This commit is contained in:
parent
cd96305f57
commit
f622c3cfee
1 changed files with 8 additions and 6 deletions
12
src/main.rs
12
src/main.rs
|
@ -2,8 +2,6 @@
|
||||||
extern crate anyhow;
|
extern crate anyhow;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[macro_use]
|
|
||||||
extern crate structopt;
|
|
||||||
extern crate bass_sys as bass;
|
extern crate bass_sys as bass;
|
||||||
|
|
||||||
mod audio;
|
mod audio;
|
||||||
|
@ -12,7 +10,6 @@ mod game;
|
||||||
mod hit_object;
|
mod hit_object;
|
||||||
mod skin;
|
mod skin;
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
@ -20,6 +17,7 @@ use ggez::{
|
||||||
conf::{WindowMode, WindowSetup},
|
conf::{WindowMode, WindowSetup},
|
||||||
event, ContextBuilder,
|
event, ContextBuilder,
|
||||||
};
|
};
|
||||||
|
use structopt::StructOpt;
|
||||||
|
|
||||||
use crate::game::Game;
|
use crate::game::Game;
|
||||||
|
|
||||||
|
@ -33,10 +31,11 @@ struct Opt {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
let opt = Opt::from_args();
|
||||||
stderrlog::new()
|
stderrlog::new()
|
||||||
.module("editor")
|
.module("editor")
|
||||||
.module("bass_sys")
|
.module("bass_sys")
|
||||||
.verbosity(2)
|
.verbosity(opt.verbose)
|
||||||
.init()
|
.init()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -48,8 +47,11 @@ fn main() -> Result<()> {
|
||||||
let (mut ctx, mut event_loop) = cb.build()?;
|
let (mut ctx, mut event_loop) = cb.build()?;
|
||||||
let mut game = Game::new()?;
|
let mut game = Game::new()?;
|
||||||
game.skin.load_all(&mut ctx)?;
|
game.skin.load_all(&mut ctx)?;
|
||||||
let path = env::args().nth(1).unwrap();
|
|
||||||
|
if let Some(path) = opt.path {
|
||||||
game.load_beatmap(path)?;
|
game.load_beatmap(path)?;
|
||||||
|
}
|
||||||
|
|
||||||
event::run(&mut ctx, &mut event_loop, &mut game)?;
|
event::run(&mut ctx, &mut event_loop, &mut game)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue