#[derive(Debug, Clone, Copy)]
pub struct Size {
pub width: f32,
pub height: f32,
}
#[derive(Debug, Clone, Copy)]
pub struct Point {
pub x: f32,
pub y: f32,
}
#[derive(Debug, Clone)]
pub struct Rect {
pub origin: Point,
pub size: Size,
}
impl Size {
pub fn new(width: f32, height: f32) -> Self {
Self { width, height }
}
}
impl Point {
pub fn new(x: f32, y: f32) -> Self {
Self { x, y }
}
}
impl Rect {
pub fn new(x: f32, y: f32, width: f32, height: f32) -> Self {
Self {
origin: Point::new(x, y),
size: Size::new(width, height),
}
}
}
impl Default for Size {
fn default() -> Self {
Self {
width: 800.0,
height: 600.0,
}
}
}
impl Default for Point {
fn default() -> Self {
Self { x: 0.0, y: 0.0 }
}
}
impl Default for Rect {
fn default() -> Self {
Self {
origin: Point::default(),
size: Size::default(),
}
}
}