feat: added clap for level parsing

- Camera sets up as a child of player entity
This commit is contained in:
Alexey 2026-03-30 20:43:46 +03:00
commit 3cddecf592
7 changed files with 156 additions and 13 deletions

View file

@ -7,6 +7,7 @@ use bevy_rapier2d::{
prelude::*,
rapier::prelude::IntegrationParameters,
};
use clap::Parser;
pub mod input;
pub mod inventory;
@ -37,7 +38,15 @@ pub enum LoadingState {
Ready,
}
fn camera_bundle() -> impl Bundle {
#[derive(Parser, Resource, Clone, PartialEq, Eq, Hash, Debug, Reflect, Default)]
#[reflect(Resource, Clone, PartialEq, Hash, Debug, Default)]
pub struct StartupArgs {
#[arg(long, short, default_value = "levels/level.toml")]
/// Level to load (relative to assets folder)
level: String,
}
pub fn camera_bundle() -> impl Bundle {
(
Camera2d,
Camera {
@ -67,7 +76,6 @@ pub const fn meters(value: f32) -> f32 {
}
fn setup_global(mut commands: Commands) {
commands.spawn(camera_bundle());
commands.spawn(ui::UiRoot::new());
}