codecraft 0.1.1

A minimalist 3D game engine built on parts of Bevy (ECS, color) with wgpu and winit: OpenPBR materials, clustered lighting, an immediate-mode UI, audio and gamepad haptics
Documentation
use bevy_ecs::prelude::*;

/// Marks an entity as a non-interactive background panel.
///
/// Combine with [`super::Position`], [`super::Size`] and [`super::Background`].
#[derive(Component)]
pub struct PanelMarker;

/// The bar across the top of a panel: its title, and what you drag to move it.
#[derive(Component, Clone, Copy, Debug)]
pub struct TitleBar {
    /// The panel this bar belongs to.
    pub panel: Entity,
}

/// Every entity a panel spawned, so moving the panel moves its contents.
///
/// Not a hierarchy -- one level is all a panel has, and a `Vec` on the panel
/// would have to be kept in step with a list that is rebuilt from scratch.
#[derive(Component, Clone, Copy, Debug)]
pub struct PanelChild(pub Entity);

/// On a close button: which panel it shuts.
#[derive(Component, Clone, Copy, Debug)]
pub struct ClosesPanel(pub Entity);

/// Put on a panel by [`super::systems::dispatch_panel_close_system`] when its
/// close button is clicked.
///
/// A marker rather than a despawn: a panel's lifetime belongs to whatever put
/// it up -- the outliner rebuilds its own rows and has to know it was closed
/// rather than find itself gone.
#[derive(Component, Clone, Copy, Debug)]
pub struct Closed;

/// A panel that can be dragged by its title bar. Panels without one cannot
/// be moved, and a panel with one can opt out -- a main menu is centred on
/// purpose and should stay there.
#[derive(Component, Clone, Copy, Debug)]
pub struct Movable;

/// A drag in progress: where the pointer was, and where the panel was.
#[derive(Component, Clone, Copy, Debug)]
pub struct Dragging {
    pub from: (f32, f32),
    pub origin: (f32, f32),
}