diff --git a/src/sdl2/rect.rs b/src/sdl2/rect.rs index 308a0bef..4141c4d1 100644 --- a/src/sdl2/rect.rs +++ b/src/sdl2/rect.rs @@ -453,12 +453,24 @@ impl DerefMut for Rect { } } +impl Into for Rect { + fn into(self) -> ll::SDL_Rect { + self.raw + } +} + impl Into<(i32, i32, u32, u32)> for Rect { fn into(self) -> (i32, i32, u32, u32) { (self.raw.x, self.raw.y, self.raw.w as u32, self.raw.h as u32) } } +impl From for Rect { + fn from(raw: ll::SDL_Rect) -> Rect { + Rect { raw: raw } + } +} + impl From<(i32, i32, u32, u32)> for Rect { fn from((x, y, width, height): (i32, i32, u32, u32)) -> Rect { Rect::new(x, y, width, height)