Browse Source

textium: rect: numcast

lol there was a bug in this and it fucking sucked
master
Erin 8 years ago
parent
commit
c26650a729
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      textium/src/geometry.rs

+ 13
- 0
textium/src/geometry.rs View File

@ -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
#[derive(Debug, Hash, Eq, PartialEq, Copy, Clone)]
pub struct Vec2<T> {


Loading…
Cancel
Save