#[derive(Default, Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Rect {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}
impl Rect {
pub fn max_x(&self) -> f32 {
self.x + self.width
}
pub fn max_y(&self) -> f32 {
self.y + self.height
}
pub fn min_x(&self) -> f32 {
self.x
}
pub fn min_y(&self) -> f32 {
self.y
}
pub fn center_x(&self) -> f32 {
self.x + self.width * 0.5
}
pub fn center_y(&self) -> f32 {
self.y + self.height * 0.5
}
}