agnosticlayer 0.2.0

A cheap, drop-in way to add UI data to your engine — no decisions about which dependency to pull in, no wrestling with how complicated it should be. Built as the tool I wanted for myself, now it's yours.
Documentation
use wibr::New;

use crate::base_data::*;
use crate::node::Node;

#[derive(Debug, Clone, Copy, PartialEq, New, Default)]
pub struct Label<Text: TextItem, Id: WidgetId> {
    pub node: Node<Id>,
    pub rotate: Rotate,
    pub text_style: TextStyle<Text>,
    pub color: Color,
    pub visual_mode: VisualMode,
}

impl<Text, Id> Label<Text, Id>
where 
    Text: TextItem,
    Id: WidgetId
{
    pub fn as_text(&self) -> &str { self.text_style.as_text() }
}

#[derive(Debug, Clone, Copy, PartialEq, New, Default)]
pub struct TextStyle<Text: TextItem> {
    pub text: Text,
    pub font_size: FontSize,
    pub color: Color,
    pub line_height: LineHeight,
    pub letter_spacing: LetterSpacing,
    pub align: Align,
}

impl<Text> TextStyle<Text>
where 
    Text: TextItem,
{
    pub fn as_text(&self) -> &str { self.text.as_text() }
}