//! Oxide Engine — core library.
//!
//! Each system lives in its own module and is independently usable.
//! Systems are enabled progressively as stages are completed.

#![deny(warnings)]

// Lets `#[derive(Reflect)]` emit `::oxide_engine::reflect::…` paths that
// resolve even when the derive is used *inside* this crate (e.g. on the
// engine's own component types). Standard proc-macro self-reference trick.
extern crate self as oxide_engine;

pub mod app;
pub mod asset;
pub mod input;
pub mod layer;
pub mod math;
pub mod prefab;
pub mod project;
pub mod reflect;
pub mod render;
pub mod scene;
pub mod settings;
pub mod ui;
pub mod watch;
pub mod window;

// Re-exported so engine consumers can use GPU/windowing/ECS types without
// declaring (and version-matching) their own direct dependency.
pub use hecs;
pub use wgpu;
pub use winit;

pub mod prelude {
    //! Common imports for engine consumers.
    //!
    //! The core engine container ([`App`](crate::app::App)) and the windowing
    //! event-handler trait ([`WindowApp`](crate::window::WindowApp)) both live
    //! here — they cover different roles and no longer share a name (Stage 6
    //! resolved the Stage-5 naming clash).
    pub use crate::app::{App, DefaultModules, Module, Schedule};
    pub use crate::asset::{
        load_gltf, AssetDatabase, AssetKind, AssetRef, AssetServer, AssetUid, GltfModel, Handle,
    };
    pub use crate::input::{
        ActionMap, ActionOverrides, Axis2DBinding, AxisBinding, Binding, InputState,
    };
    pub use crate::layer::{GroupRegistry, Layer, LayerMask, LayerRegistry, Tags};
    pub use crate::math::{
        Aabb, Color, EulerRot, Frustum, Mat3, Mat4, Plane, Quat, Range3, Ray, Rect, Transform,
        Vec2, Vec3, Vec4,
    };
    pub use crate::prefab::{ComponentSpec, Prefab, PrefabRegistry};
    pub use crate::project::{Project, RecentProjects};
    pub use crate::reflect::TypeRegistry;
    pub use crate::render::{
        Camera, ClearPass, DirectionalLight, ForwardPass, ForwardRenderer, FrameContext, Gpu,
        GpuMesh, Lighting, Material, Mesh, MeshRenderer, PrimitiveShape, RenderContext,
        RenderObject, RenderPass, RenderPipeline, UiBatch, UiOverlayPass, Vertex,
    };
    pub use crate::scene::{DespawnPolicy, Entity, Node, Scene, SceneError, SceneSnapshot};
    pub use crate::settings::Settings;
    pub use crate::ui::hit_test as ui_hit_test;
    pub use crate::ui::{
        layout as ui_layout, paint as ui_paint, shape as ui_shape, shape_runs as ui_shape_runs,
        Align as UiAlign, Anchor as UiAnchor, AnchorGroup as UiAnchorGroup,
        AtlasEntry as UiAtlasEntry, Border as UiBorder, DrawCommand as UiDrawCommand,
        Font as UiFont, FontId as UiFontId, FontRef as UiFontRef, FontStore as UiFontStore,
        FontWeight as UiFontWeight, GlyphAtlas as UiGlyphAtlas, GlyphId as UiGlyphId,
        GlyphKey as UiGlyphKey, Grid as UiGrid, Insets as UiInsets, LayoutNode as UiLayoutNode,
        LayoutStyle as UiLayoutStyle, LayoutTree as UiLayoutTree, PaintedFrame as UiPaintedFrame,
        Router as UiRouter, RouterEvent as UiRouterEvent, RouterFrame as UiRouterFrame,
        ShapeParams as UiShapeParams, ShapedGlyph as UiShapedGlyph, ShapedLine as UiShapedLine,
        ShapedText as UiShapedText, Sizing as UiSizing, Stack as UiStack,
        StackDirection as UiStackDirection, TextAlign as UiTextAlign, TextRun as UiTextRun,
        TextStyle as UiTextStyle, Theme as UiTheme, UiPanel, VisualStyle as UiVisualStyle, Widget,
        WidgetId, WidgetKind, WidgetPath, WidgetValue,
    };
    pub use crate::watch::{reload_changed_assets, ChangeEvent, ChangeKind, FileWatcher};
    pub use crate::window::{run, AppCtx, WindowApp, WindowConfig};
}
