//! Defines generic despawn/cleanup function and cleanup marker components

use bevy::prelude::*;

/// Despawn/cleanup every entity with `T`.
/// See the [bevy cheatbook's cleanup example](https://bevy-cheatbook.github.io/patterns/generic-systems.html#example-cleanup).
pub fn despawn<T: Component>(mut c: Commands, q: Query<Entity, With<T>>) {
    for e in q {
        c.entity(e).despawn();
    }
}

#[derive(Component)]
pub struct Scene;
