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:
parent
b72d0451a6
commit
41f72f3c7a
|
@ -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_())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue