Made gl_set_swap_interval() return Result, not bool

Resolves #755
This commit is contained in:
Simon Heath
2018-03-31 19:00:04 +02:00
committed by Cobrand
parent 809fee03a1
commit e9f2e33797
+7 -2
View File
@@ -791,8 +791,13 @@ impl VideoSubsystem {
}
}
pub fn gl_set_swap_interval<S: Into<SwapInterval>>(&self, interval: S) -> bool {
unsafe { sys::SDL_GL_SetSwapInterval(interval.into() as c_int) == 0 }
pub fn gl_set_swap_interval<S: Into<SwapInterval>>(&self, interval: S) -> Result<(), String> {
let result = unsafe { sys::SDL_GL_SetSwapInterval(interval.into() as c_int) };
if result == 0{
Ok(())
} else {
Err(get_error())
}
}
pub fn gl_get_swap_interval(&self) -> SwapInterval {