From 7c075ca5f30e26ceddc74fd144d3e4ba21a37239 Mon Sep 17 00:00:00 2001 From: Vlad-Stefan Harbuz Date: Fri, 16 Dec 2022 12:25:46 +0000 Subject: add SDL_(Un)LockTexture Signed-off-by: Vlad-Stefan Harbuz --- sdl2/render.ha | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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, -- cgit v1.2.3