nightshade 0.52.0

A cross-platform data-oriented game engine.
Documentation
//! The camera controller composition for apps with one controller mode:
//! the active camera's component set picks the controller each frame.

use crate::app::{App, Plugin};
use crate::ecs::world::World;
use crate::schedule::{FramePhase, schedule_push};

/// Registers the controller dispatch into the frame schedule's update
/// phase, before transform propagation picks up the camera's writes.
pub fn install(world: &mut World) {
    schedule_push(
        &mut world.resources.schedules.frame,
        FramePhase::Update,
        crate::ecs::camera::systems::camera_controllers_system,
    );
}

/// Drives the active camera every frame: pan-orbit when it carries
/// `PAN_ORBIT_CAMERA`, the fly controller otherwise. Games that switch
/// controllers on their own state, or drive first- or third-person
/// cameras, skip the plugin and call the per-controller systems from
/// their update systems instead.
pub struct CameraControllerPlugin;

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