mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
add From and Into for Rect on ll::SDL_Rect
This commit is contained in:
@@ -453,12 +453,24 @@ impl DerefMut for Rect {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<ll::SDL_Rect> 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<ll::SDL_Rect> 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)
|
||||
|
||||
Reference in New Issue
Block a user