diff --git a/src/main.rs b/src/main.rs index 78bfd8f..dd9331b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,12 @@ impl From for Seed { } } +impl From for [u8; 8] { + fn from(value: Seed) -> Self { + value.0.to_le_bytes() + } +} + #[derive(Resource)] struct PlayableArea(f32, f32); @@ -55,6 +61,8 @@ struct PlayerSize(f32); fn run_app(settings: AppSettings) -> AppExit { let seed = Seed::from(settings.seed); App::new() + .insert_resource(Gravity(Vector::ZERO)) + .insert_resource(seed.clone()) .add_plugins(( DefaultPlugins.set(WindowPlugin { primary_window: Window { @@ -66,7 +74,7 @@ fn run_app(settings: AppSettings) -> AppExit { ..default() }), PhysicsPlugins::default().with_length_unit(50.0), - EntropyPlugin::::with_seed(seed.0.to_le_bytes()), // TODO: Tried to make an Into<[u8; 8]> for this but it wants to consume the value + EntropyPlugin::::with_seed(seed.into()), )) .add_systems( Startup, @@ -81,8 +89,6 @@ fn run_app(settings: AppSettings) -> AppExit { (move_player, quit.run_if(input_pressed(KeyCode::KeyQ))), ) .add_systems(PostUpdate, move_camera) - .insert_resource(Gravity(Vector::ZERO)) - .insert_resource(seed) .run() }