generated from 2ndbeam/bevy-template
feat: added clap for level parsing
- Camera sets up as a child of player entity
This commit is contained in:
parent
79fe190b6b
commit
3cddecf592
7 changed files with 156 additions and 13 deletions
12
src/lib.rs
12
src/lib.rs
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue