nightshade 0.57.0

A cross-platform data-oriented game engine.
Documentation
//! What the interface layer reports to the rest of the engine each frame.
//!
//! A leaf resource, like [`crate::viewport::Viewport`]: it names only engine
//! entities and plain sizes, so input translation, the camera controllers, the
//! gizmo overlays, and the render driver can all read it without depending on
//! one another. Nothing inside `nightshade-ui` reads or writes it, which is why
//! it lives here rather than in that crate.

/// Per-frame arbitration between the interface and everything else: whether the
/// interface swallowed this frame's input, and which cameras it needs rendered
/// into offscreen viewport textures.
#[derive(Default)]
pub struct UserInterface {
    /// Set when an interface layer consumed the frame's input event, so game
    /// input translation skips it.
    pub consumed_event: bool,
    /// Cameras whose viewport textures the interface needs this frame. Drained
    /// by the render driver when it builds the frame's view inputs.
    pub required_cameras: Vec<nightshade_ecs::Entity>,
    /// Requested pixel size per entry in [`Self::required_cameras`].
    pub required_camera_sizes: Vec<(u32, u32)>,
    /// Actual pixel size the renderer allocated per viewport texture, written
    /// back after the frame so the next frame can lay out against real sizes.
    pub viewport_texture_sizes: Vec<(u32, u32)>,
    /// Set while the pointer is over an interface element that should own it,
    /// so camera controllers and picking stand down.
    pub hud_wants_pointer: bool,
    /// Set while an interface outside the retained tree is taking typing, the
    /// developer console being the one in the engine. The retained tree answers
    /// for itself through `ui_wants_keyboard`; this covers everything that
    /// draws its own text entry.
    pub hud_wants_keyboard: bool,
}