aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2021-12-11 12:50:12 +0100
committerDrew DeVault <sir@cmpwn.com>2021-12-11 12:50:12 +0100
commit89dbe1ad56becac574114ecec258dfd464b82633 (patch)
tree7250f183b074f169a994409692fd16f7b3cdd8c6
parentgamecontroller: add button enum (diff)
downloadhare-chip8-89dbe1ad56becac574114ecec258dfd464b82633.tar.gz
Add SetTextureAlphaMod wrapper
-rw-r--r--sdl2/render.ha16
1 files changed, 16 insertions, 0 deletions
diff --git a/sdl2/render.ha b/sdl2/render.ha
index 649e786..0bba541 100644
--- a/sdl2/render.ha
+++ b/sdl2/render.ha
@@ -123,6 +123,22 @@ export fn set_texture_color_mod(
return wrapvoid(_set_texture_color_mod(texture, r, g, b));
};
+@symbol("SDL_SetTextureAlphaMod") fn _set_texture_alpha_mod(texture: *texture, a: u8) int;
+
+// Set an additional alpha value multiplied into render copy operations.
+//
+// When this texture is rendered, during the copy operation the source alpha
+// value is modulated by this alpha value according to the following formula:
+//
+// `srcA = srcA * (alpha / 255)`
+//
+// Alpha modulation is not always supported by the renderer; it will return an
+// error if alpha modulation is not supported.
+export fn set_texture_alpha_mod(texture: *texture, a: u8) (void | error) = {
+ // TODO: Double check errors
+ return wrapvoid(_set_texture_alpha_mod(texture, a));
+};
+
@symbol("SDL_RenderCopy") fn _render_copy(renderer: *renderer,
texture: *texture, srcrect: nullable *rect, dstrect: nullable *rect) int;