hUI/hui/src/frame.rs
2024-03-25 18:13:10 +01:00

29 lines
837 B
Rust

//! modular procedural background system
use glam::Vec2;
use crate::draw::UiDrawCommandList;
pub mod point;
mod rect;
pub mod stack;
pub mod nine_patch;
mod impls;
pub use rect::FrameRect;
/// Trait for a drawable frame
pub trait Frame {
/// Draw the frame at the given position and size
fn draw(&self, draw: &mut UiDrawCommandList, position: Vec2, parent_size: Vec2);
/// Check if the frame is guaranteed to be fully opaque and fully cover the parent frame regardless of it's size
///
/// Returns true if the frame:
/// - Is fully opaque (i.e. `alpha >= 1.0`)
/// - Completely covers (or exceeds the size of) the frame
///
/// False negatives are acceptable, but false positives ***are not***.\
/// May be used for optimization purposes
fn covers_opaque(&self) -> bool { false }
}