use macroquad::prelude::{Color, Vec2};
#[derive(Debug, Clone, PartialEq)]
pub enum Shape {
Circle { r: f32 },
Rect { w: f32, h: f32 },
Line { to: Vec2 },
Arrow { to: Vec2 },
Polygon { pts: Vec<Vec2> },
Text { content: String, size: f32 },
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum FontKind {
Serif,
#[default]
Mono,
MonoBold,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct StrokeStyle {
pub fill: bool,
pub outline: bool,
pub width: f32,
pub outline_color: Option<Color>,
}
impl Default for StrokeStyle {
fn default() -> Self {
StrokeStyle { fill: true, outline: false, width: 2.5, outline_color: None }
}
}
#[derive(Debug, Clone)]
pub struct Entity {
pub id: String,
pub shape: Shape,
pub pos: Vec2,
pub color: Color,
pub opacity: f32,
pub scale: f32,
pub z: i32,
pub stroke: StrokeStyle,
pub font: FontKind,
pub rot: f32,
pub wrap: Option<f32>,
pub follow: Option<(String, Vec2)>,
}
impl Entity {
pub fn new(id: impl Into<String>, shape: Shape, pos: Vec2, color: Color) -> Self {
Entity {
id: id.into(),
shape,
pos,
color,
opacity: 1.0,
scale: 1.0,
z: 0,
stroke: StrokeStyle::default(),
font: FontKind::default(),
rot: 0.0,
wrap: None,
follow: None,
}
}
}