From 3c06ff4e6696a172f799abf6c39a991d8a7e86f0 Mon Sep 17 00:00:00 2001 From: Doonv <58695417+doonv@users.noreply.github.com> Date: Sat, 17 Feb 2024 22:18:35 +0200 Subject: [PATCH] Create a `SystemSet` for `PixelCameraPlugin`'s systems --- src/lib.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ea55725..f9284db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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), ), ); }