hUI/hui/src/frame.rs

25 lines
740 B
Rust
Raw Normal View History

2024-03-23 13:53:32 -05:00
use glam::Vec2;
2024-03-23 19:13:20 -05:00
use crate::draw::UiDrawCommandList;
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 19:13:20 -05:00
mod impls;
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 {
2024-03-24 15:35:44 -05:00
/// Draw the frame at the given position and size
2024-03-23 17:05:54 -05:00
fn draw(&self, draw: &mut UiDrawCommandList, position: Vec2, parent_size: Vec2);
2024-03-24 15:35:44 -05:00
/// 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 }
2024-03-22 12:33:34 -05:00
}