fccm / OCamlSDL2

OCaml interface to SDL 2.0 (for Linux, Windows, MacOS, and ChromeBook)
Other
51 stars 10 forks source link

Add SDL_SetRenderTarget binding #29

Closed csoren closed 2 years ago

csoren commented 2 years ago

This PR implements the useful SDL function SDL_SetRenderTarget for setting a texture as a renderer's target.

SDL_SetRenderTarget accepts NULL as the destination texture, in which case the target is reverted to the renderer's default. This is implemented by the use of an explicit Sdltexture.t option argument. I considered ?texture:Sdltexture.t, but to clear the texture, the user would have to do set_render_target renderer () which doesn't convey intention well.