diff --git a/src/common.rs b/src/common.rs index 62568d3..77ae287 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,4 +1,4 @@ -use num_traits::Num; +use num_traits::{Num, AsPrimitive}; use crate::bitfield; @@ -215,3 +215,12 @@ impl Rect { } } } + +impl> Into for Rect { + 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_()) + } +}