|
@ -80,6 +80,19 @@ impl<T> From<rusttype::Rect<T>> for Rect<T> where T: Sub<Output=T> + Copy { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<S> Rect<S> where S: NumCast + Copy {
|
|
|
|
|
|
pub fn cast<T>(&self) -> Rect<T> where T: NumCast {
|
|
|
|
|
|
Rect {
|
|
|
|
|
|
x: NumCast::from(self.x).unwrap(),
|
|
|
|
|
|
y: NumCast::from(self.y).unwrap(),
|
|
|
|
|
|
w: NumCast::from(self.w).unwrap(),
|
|
|
|
|
|
h: NumCast::from(self.h).unwrap(),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A 2D vector
|
|
|
/// A 2D vector
|
|
|
#[derive(Debug, Hash, Eq, PartialEq, Copy, Clone)]
|
|
|
#[derive(Debug, Hash, Eq, PartialEq, Copy, Clone)]
|
|
|
pub struct Vec2<T> {
|
|
|
pub struct Vec2<T> {
|
|
|