cli: skip to level

This commit is contained in:
Pascal Engélibert 2022-08-25 15:52:28 +02:00
commit 21d98a4a1d
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA
2 changed files with 14 additions and 1 deletions

View file

@ -26,10 +26,20 @@ fn main() {
#[cfg(not(target_arch = "wasm32"))]
std::thread::spawn(move || audio::setup(audio_event_receiver));
#[cfg(not(target_arch = "wasm32"))]
let first_level = game::LevelId(
std::env::args()
.nth(1)
.map_or(0, |s| s.parse().unwrap_or(0)),
);
#[cfg(target_arch = "wasm32")]
let first_level = game::LevelId(0);
App::new()
.insert_resource(Msaa { samples: 4 })
.insert_resource(audio_event_sender)
.add_state(AppState::Menu)
.insert_resource(game::FirstLevel(first_level))
.insert_resource(ClearColor(Color::BLACK))
.add_plugins(DefaultPlugins)
.add_plugin(RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(64.0))