diff --git a/src/main.rs b/src/main.rs index 29238c0..545b253 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,18 +72,25 @@ fn setup( mut commands: Commands, mut materials: ResMut>, boid_mesh: Res, + windows: Query<&Window>, ) { + let window = windows.get_single().unwrap(); + let half_width = window.resolution.width() / 4.; + let half_height = window.resolution.height() / 2.; + let boid_color = materials.add(Color::from(tailwind::NEUTRAL_50)); let mut small_rng = rand::rngs::SmallRng::from_entropy(); - let lower_bound = -100.; - let upper_bound = 100.; + let lower_width = -half_width; + let upper_width = half_width; + let lower_height = -half_height; + let upper_height = half_height; for i in 0..1000 { use std::f32::consts::TAU; - let x = small_rng.gen_range(lower_bound..=upper_bound); - let y = small_rng.gen_range(lower_bound..=upper_bound); + let x = small_rng.gen_range(lower_width..=upper_width); + let y = small_rng.gen_range(lower_height..=upper_height); let angle = small_rng.gen_range(-TAU..=TAU);