diff --git a/examples/text_image.rs b/examples/text_image.rs index 398c8fd..0dd8eb1 100644 --- a/examples/text_image.rs +++ b/examples/text_image.rs @@ -1,12 +1,14 @@ use std::f32::consts::PI; use bevy::{ - input::common_conditions::input_just_pressed, prelude::*, render::{ + input::common_conditions::input_just_pressed, + prelude::*, + render::{ camera::RenderTarget, render_resource::{ Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, }, - } + }, }; fn main() { @@ -15,8 +17,7 @@ fn main() { .add_systems(Startup, add_texture) .add_systems( Update, - rotate_mesh - .run_if(input_just_pressed(KeyCode::Space)), + rotate_mesh.run_if(input_just_pressed(KeyCode::Space)), ) .run(); } diff --git a/src/camera.rs b/src/camera.rs index 0f50cc5..5777825 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -5,9 +5,15 @@ pub(crate) struct CameraPlugin; impl Plugin for CameraPlugin { fn build(&self, app: &mut App) { - app.add_systems(Update, move_editor_fly_camera); - app.add_systems(Update, rotate_editor_fly_camera); - } + app.add_systems( + Update, + move_editor_fly_camera.run_if(any_with_component::), + ); + app.add_systems( + Update, + rotate_editor_fly_camera.run_if(any_with_component::), + ); + } } #[derive(Component)] @@ -16,97 +22,102 @@ pub(crate) struct FlyCamera; /// Fly camera system for moving around like a drone /// TODO: Only if key is pressed! fn move_editor_fly_camera( - mut cameras: Query<(&Camera, &mut Transform), With>, - windows: Query<&Window>, - primary_window: Query>, - keys: Res>, - time: Res