nightshade 0.14.0

A cross-platform data-oriented game engine.
Documentation
use nalgebra_glm::{Vec2, Vec4};

#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
pub enum UiLayer {
    #[default]
    Background = 0,
    DockedPanels = 10,
    FloatingPanels = 20,
    Popups = 30,
    DockIndicator = 40,
    Tooltips = 50,
}

#[derive(Clone, Copy, Debug, Default)]
pub struct UiShadow {
    pub color: Vec4,
    pub offset: Vec2,
    pub blur: f32,
    pub spread: f32,
}

#[derive(Clone, Debug)]
pub struct UiRect {
    pub position: Vec2,
    pub size: Vec2,
    pub color: Vec4,
    pub corner_radius: f32,
    pub border_width: f32,
    pub border_color: Vec4,
    pub rotation: f32,
    pub clip_rect: Option<crate::ecs::ui::types::Rect>,
    pub layer: UiLayer,
    pub z_index: i32,
    pub shadow: Option<UiShadow>,
    pub effect_kind: u32,
    pub effect_params: [f32; 4],
    pub quad_corners: Option<[Vec2; 4]>,
}

impl Default for UiRect {
    fn default() -> Self {
        Self {
            position: Vec2::new(0.0, 0.0),
            size: Vec2::new(100.0, 100.0),
            color: Vec4::new(0.2, 0.2, 0.2, 0.8),
            corner_radius: 0.0,
            border_width: 0.0,
            border_color: Vec4::new(1.0, 1.0, 1.0, 1.0),
            rotation: 0.0,
            clip_rect: None,
            layer: UiLayer::Background,
            z_index: 0,
            shadow: None,
            effect_kind: 0,
            effect_params: [0.0; 4],
            quad_corners: None,
        }
    }
}