2021-01-05 10:17:41 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate anyhow;
|
2021-01-09 20:03:04 +00:00
|
|
|
#[allow(unused_macros, unused_imports)]
|
2021-01-05 10:17:41 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
extern crate bass_sys as bass;
|
|
|
|
|
|
|
|
mod audio;
|
2021-01-08 22:35:24 +00:00
|
|
|
mod beatmap;
|
2021-01-05 10:17:41 +00:00
|
|
|
mod game;
|
2021-01-09 20:03:04 +00:00
|
|
|
mod hitobject;
|
2021-01-08 10:51:04 +00:00
|
|
|
mod skin;
|
2021-01-08 07:21:39 +00:00
|
|
|
|
2021-01-09 18:11:56 +00:00
|
|
|
use std::path::PathBuf;
|
2021-01-05 10:17:41 +00:00
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
use ggez::{
|
|
|
|
conf::{WindowMode, WindowSetup},
|
|
|
|
event, ContextBuilder,
|
|
|
|
};
|
2021-01-09 18:17:51 +00:00
|
|
|
use structopt::StructOpt;
|
2021-01-05 10:17:41 +00:00
|
|
|
|
|
|
|
use crate::game::Game;
|
|
|
|
|
2021-01-09 18:11:56 +00:00
|
|
|
#[derive(StructOpt)]
|
|
|
|
struct Opt {
|
|
|
|
path: Option<PathBuf>,
|
|
|
|
|
|
|
|
/// Verbose mode (-v, -vv, -vvv, etc)
|
|
|
|
#[structopt(short = "v", long = "verbose", parse(from_occurrences))]
|
|
|
|
verbose: usize,
|
|
|
|
}
|
|
|
|
|
2021-01-05 10:17:41 +00:00
|
|
|
fn main() -> Result<()> {
|
2021-01-09 18:17:51 +00:00
|
|
|
let opt = Opt::from_args();
|
2021-01-05 10:17:41 +00:00
|
|
|
stderrlog::new()
|
|
|
|
.module("editor")
|
|
|
|
.module("bass_sys")
|
2021-01-09 18:17:51 +00:00
|
|
|
.verbosity(opt.verbose)
|
2021-01-05 10:17:41 +00:00
|
|
|
.init()
|
|
|
|
.unwrap();
|
|
|
|
|
2021-01-08 13:34:30 +00:00
|
|
|
let cb = ContextBuilder::new("osu_editor", "ggez")
|
|
|
|
.add_resource_path("skin")
|
2021-01-05 10:17:41 +00:00
|
|
|
.window_setup(WindowSetup::default().title("OSU editor"))
|
|
|
|
.window_mode(WindowMode::default().dimensions(1024.0, 768.0));
|
|
|
|
|
2021-01-08 15:05:10 +00:00
|
|
|
let (mut ctx, mut event_loop) = cb.build()?;
|
2021-01-05 10:17:41 +00:00
|
|
|
let mut game = Game::new()?;
|
2021-01-08 15:05:10 +00:00
|
|
|
game.skin.load_all(&mut ctx)?;
|
2021-01-09 18:17:51 +00:00
|
|
|
|
|
|
|
if let Some(path) = opt.path {
|
|
|
|
game.load_beatmap(path)?;
|
|
|
|
}
|
|
|
|
|
2021-01-08 15:05:10 +00:00
|
|
|
event::run(&mut ctx, &mut event_loop, &mut game)?;
|
2021-01-05 10:17:41 +00:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|