18 lines
371 B
Rust
18 lines
371 B
Rust
use crate::vec2::Vec2;
|
|
use num::{Num, ToPrimitive};
|
|
|
|
#[derive(Copy, Clone)]
|
|
pub struct Rect<T: Num + Copy + ToPrimitive> {
|
|
pub pos: Vec2<T>,
|
|
pub size: Vec2<T>,
|
|
}
|
|
|
|
impl<T: Num + Copy + ToPrimitive> Rect<T> {
|
|
pub fn new(x: T, y: T, w: T, h: T) -> Rect<T> {
|
|
Rect {
|
|
pos: Vec2 { x, y },
|
|
size: Vec2 { x: w, y: h },
|
|
}
|
|
}
|
|
}
|