nightshade 0.52.0

A cross-platform data-oriented game engine.
Documentation
//! Retained-UI gizmo overlays.
//!
//! Draws transform handles (translate, rotate, scale) and the navigation gizmo
//! through the retained UI overlay system. Apps select which transform handle
//! to display by setting `world.resources.user_interface.gizmos.mode`. The
//! overlay systems run as part of the default frame schedule.

mod nav_gizmo;
mod overlay;
mod overlays_enabled;
mod state;

pub use nav_gizmo::nav_gizmo_overlay_system;
pub use overlay::gizmo_overlay_system;
pub use state::{
    GizmoMode, GizmoPlanarScaleDrag, GizmoPlanarTranslationDrag, GizmoRotationDrag, GizmoScaleDrag,
    GizmoTranslationDrag, Gizmos,
};

/// Registers the transform-handle and navigation-gizmo overlay passes
/// after transform propagation, so the handles track this frame's motion.
pub fn install(world: &mut crate::ecs::world::World) {
    use crate::schedule::{FramePhase, schedule_push};
    let schedule = &mut world.resources.schedules.frame;
    schedule_push(
        schedule,
        FramePhase::PostUpdate,
        overlay::gizmo_overlay_system,
    );
    schedule_push(
        schedule,
        FramePhase::PostUpdate,
        nav_gizmo::nav_gizmo_overlay_system,
    );
}

/// Installs the gizmo overlays through [`install`]. Select the transform
/// handle at runtime via `world.resources.user_interface.gizmos.mode`.
pub struct GizmosPlugin;

impl crate::app::Plugin for GizmosPlugin {
    fn build(&self, app: &mut crate::app::App) {
        app.add_startup_system(install);
    }
}