aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad-Stefan Harbuz <vlad@vladh.net>2022-12-16 12:25:46 +0000
committerDrew DeVault <sir@cmpwn.com>2022-12-19 12:00:47 +0100
commit7c075ca5f30e26ceddc74fd144d3e4ba21a37239 (patch)
treebdf2f033d6d215a2cec553667a3926544e5f8ee3
parentAdd SDL_GetWindowSurface wrapper (diff)
downloadhare-chip8-7c075ca5f30e26ceddc74fd144d3e4ba21a37239.tar.gz
add SDL_(Un)LockTexture
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
-rw-r--r--sdl2/render.ha13
1 files changed, 13 insertions, 0 deletions
diff --git a/sdl2/render.ha b/sdl2/render.ha
index 667c223..2b0dd07 100644
--- a/sdl2/render.ha
+++ b/sdl2/render.ha
@@ -215,6 +215,19 @@ export fn SDL_UpdateTexture(texture: *SDL_Texture,
return wrapint(_SDL_UpdateTexture(texture, rect, pixels, pitch))?: int;
};
+@symbol("SDL_LockTexture") fn _SDL_LockTexture(texture: *SDL_Texture,
+ rect: const nullable *SDL_Rect, pixels: nullable * nullable *void, pitch: *int) int;
+
+// Lock a portion of the texture for write-only pixel access.
+export fn SDL_LockTexture(texture: *SDL_Texture,
+ rect: const nullable *SDL_Rect, pixels: nullable * nullable *void, pitch: *int)
+ (int | error) = {
+ return wrapint(_SDL_LockTexture(texture, rect, pixels, pitch))?: int;
+};
+
+// Unlock a texture, uploading the changes to video memory, if needed.
+export @symbol("SDL_UnlockTexture") fn SDL_UnlockTexture(texture: *SDL_Texture) void;
+
// An enumeration of texture access patterns.
export type SDL_TextureAccess = enum int {
STATIC,