Skip to content

Commit c4f31c6

Browse files
GuillaumeGomezCobrand
authored andcommitted
Bind new functions: SDL_GL_GetCurrentContext and SDL_RenderFlush
1 parent 56f36cf commit c4f31c6

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/sdl2/render.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,15 @@ impl<T: RenderTarget> Canvas<T> {
15861586
pub unsafe fn raw_create_texture(&self, raw: *mut sys::SDL_Texture) -> Texture {
15871587
Texture { raw }
15881588
}
1589+
1590+
#[doc(alias = "SDL_RenderFlush")]
1591+
pub unsafe fn render_flush(&self) {
1592+
let ret = sys::SDL_RenderFlush(self.context.raw);
1593+
1594+
if ret != 0 {
1595+
panic!("Error setting blend: {}", get_error())
1596+
}
1597+
}
15891598
}
15901599

15911600
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]

src/sdl2/video.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,19 @@ impl Window {
12191219
}
12201220
}
12211221

1222-
/// Set the window's OpenGL context to the current context on the thread.
12231222
#[doc(alias = "SDL_GL_GetCurrentContext")]
1223+
pub unsafe fn gl_get_current_context(&self) -> Option<GLContext> {
1224+
let context_raw = sys::SDL_GL_GetCurrentContext();
1225+
1226+
if !context_raw.is_null() {
1227+
Some(GLContext { raw: context_raw })
1228+
} else {
1229+
None
1230+
}
1231+
}
1232+
1233+
/// Set the window's OpenGL context to the current context on the thread.
1234+
#[doc(alias = "SDL_GL_MakeCurrent")]
12241235
pub fn gl_set_context_to_current(&self) -> Result<(), String> {
12251236
unsafe {
12261237
let context_raw = sys::SDL_GL_GetCurrentContext();

0 commit comments

Comments
 (0)