2024-03-23 13:53:32 -05:00
|
|
|
use glam::Vec2;
|
2024-03-23 18:52:37 -05:00
|
|
|
use crate::{draw::{UiDrawCommand, UiDrawCommandList}, rect::FillColor};
|
2024-03-22 12:33:34 -05:00
|
|
|
|
2024-03-23 17:05:54 -05:00
|
|
|
pub mod point;
|
|
|
|
mod rect;
|
|
|
|
pub mod stack;
|
2024-03-23 13:42:53 -05:00
|
|
|
|
2024-03-23 17:05:54 -05:00
|
|
|
pub use rect::FrameRect;
|
2024-03-23 13:53:32 -05:00
|
|
|
|
2024-03-23 17:05:54 -05:00
|
|
|
pub trait Frame {
|
|
|
|
fn draw(&self, draw: &mut UiDrawCommandList, position: Vec2, parent_size: Vec2);
|
2024-03-22 12:33:34 -05:00
|
|
|
}
|
2024-03-23 18:52:37 -05:00
|
|
|
|
|
|
|
impl Frame for FillColor {
|
|
|
|
fn draw(&self, draw: &mut UiDrawCommandList, position: Vec2, parent_size: Vec2) {
|
|
|
|
draw.add(UiDrawCommand::Rectangle {
|
|
|
|
position,
|
|
|
|
size: parent_size,
|
|
|
|
color: self.corners(),
|
|
|
|
texture: None,
|
|
|
|
rounded_corners: None,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// impl<T: Into<FillColor> + Clone> Frame for T {
|
|
|
|
// fn draw(&self, draw: &mut UiDrawCommandList, position: Vec2, parent_size: Vec2) {
|
|
|
|
// let color: FillColor = self.clone().into();
|
|
|
|
// draw.add(UiDrawCommand::Rectangle {
|
|
|
|
// position,
|
|
|
|
// size: parent_size,
|
|
|
|
// color: color.corners(),
|
|
|
|
// texture: None,
|
|
|
|
// rounded_corners: None,
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// }
|