1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-16 19:02:47 +00:00

add Into<ggez::Rect> for our internal Rect<T>

This commit is contained in:
Alula 2020-09-10 12:26:24 +02:00
parent b72d0451a6
commit 41f72f3c7a
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA

View file

@ -1,4 +1,4 @@
use num_traits::Num; use num_traits::{Num, AsPrimitive};
use crate::bitfield; use crate::bitfield;
@ -215,3 +215,12 @@ impl<T: Num + Copy> Rect<T> {
} }
} }
} }
impl<T: Num + Copy + AsPrimitive<f32>> Into<crate::ggez::graphics::Rect> for Rect<T> {
fn into(self) -> crate::ggez::graphics::Rect {
crate::ggez::graphics::Rect::new(self.top.as_(),
self.left.as_(),
self.bottom.sub(self.top).as_(),
self.right.sub(self.left).as_())
}
}