Skip to content

Commit

Permalink
Create a SystemSet for PixelCameraPlugin's systems
Browse files Browse the repository at this point in the history
  • Loading branch information
doonv committed Feb 17, 2024
1 parent 610baee commit 3c06ff4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,30 @@ pub mod prelude;
mod systems;
pub mod viewport;

/// A [`SystemSet`] for [`PixelCameraPlugin`]'s systems.
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum CameraSystems {
/// The systems that initialize the [`PixelCamera`](components::PixelCamera)
/// component when it's added to an entity.
Initialization,
/// The systems that update the pixel camera's position after every frame.
Update,
}

/// The [`PixelCameraPlugin`] handles initialization and updates of the [`PixelCamera`](components::PixelCamera).
///
/// It also disables [`Msaa`].
pub struct PixelCameraPlugin;
impl Plugin for PixelCameraPlugin {
fn build(&self, app: &mut App) {
use crate::systems::*;
use systems::*;

app.insert_resource(Msaa::Off).add_systems(
PostUpdate,
(
init_camera,
update_viewport_size,
smooth_camera,
set_camera_position,
init_camera.in_set(CameraSystems::Initialization),
(update_viewport_size, smooth_camera, set_camera_position)
.in_set(CameraSystems::Update),
),
);
}
Expand Down

0 comments on commit 3c06ff4

Please sign in to comment.