use super::*;
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, New, PartialEq)]
pub struct EntityId {
#[get(type(copy))]
pub(crate) index: u32,
#[get(type(copy))]
pub(crate) generation: u32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct EntityTransform {
#[get(type(copy))]
pub(crate) position: Point,
#[get(type(copy))]
pub(crate) rotation_rad: f32,
#[get(type(copy))]
pub(crate) scale: Size,
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct Velocity2D {
#[get(type(copy))]
pub(crate) vx: f32,
#[get(type(copy))]
pub(crate) vy: f32,
#[get(type(copy))]
pub(crate) angular: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct RigidBody2D {
#[get(type(copy))]
pub(crate) kind: BodyKind,
#[get(type(copy))]
pub(crate) inv_mass: f32,
#[get(type(copy))]
pub(crate) restitution: f32,
#[get(type(copy))]
pub(crate) linear_drag: f32,
#[get(type(copy))]
pub(crate) gravity_scale: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct Collider2D {
#[get(type(copy))]
pub(crate) shape: ColliderShape,
#[get(type(copy))]
pub(crate) layer: u32,
#[get(type(copy))]
pub(crate) mask: u32,
#[get(type(copy))]
pub(crate) is_trigger: bool,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct Sprite2D {
#[get(type(copy))]
pub(crate) shape: EntityVisualShape,
#[get(type(copy))]
pub(crate) size: Size,
#[get(type(copy))]
pub(crate) color: Color,
#[get(type(copy))]
pub(crate) accent: Color,
#[get(type(copy))]
pub(crate) z_order: i32,
#[get(type(copy))]
pub(crate) corner_radius: f32,
#[get(type(copy))]
pub(crate) visible: bool,
}
#[derive(Clone, Data, Debug, PartialEq)]
pub struct EntityRecord {
#[get(type(copy))]
pub(crate) id: EntityId,
#[get(type(copy))]
pub(crate) alive: bool,
#[get(type(copy))]
pub(crate) tag: EntityTag,
#[get(type(copy))]
pub(crate) transform: EntityTransform,
#[get(type(copy))]
pub(crate) velocity: Velocity2D,
#[get(skip)]
pub(crate) body: Option<RigidBody2D>,
#[get(skip)]
pub(crate) collider: Option<Collider2D>,
#[get(skip)]
pub(crate) sprite: Option<Sprite2D>,
#[get(type(copy))]
pub(crate) health: f32,
#[get(type(copy))]
pub(crate) max_health: f32,
#[get(skip)]
pub(crate) ttl_secs: Option<f32>,
#[get(type(copy))]
pub(crate) user_data: u64,
}
#[derive(Clone, Data, Debug, Default)]
pub struct GameWorld {
pub(crate) entities: Vec<EntityRecord>,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) free_list: Vec<u32>,
#[get(type(copy))]
pub(crate) live_count: usize,
#[get(type(copy))]
pub(crate) tick: u64,
}