From c3295e014d979c0213b3fb7e4837b5356bc8fdb4 Mon Sep 17 00:00:00 2001 From: jussi Date: Mon, 30 Oct 2023 22:40:20 +0200 Subject: Reintroducing Unload functions. Is*Ready functions. GC_UNLOAD setting and check function. --- src/textures.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'src/textures.c') diff --git a/src/textures.c b/src/textures.c index abfdf01..9f65ab5 100644 --- a/src/textures.c +++ b/src/textures.c @@ -54,6 +54,34 @@ int ltexturesLoadImageFromScreen( lua_State *L ) { return 1; } +/* +> isReady = RL.IsImageReady( Image image ) + +Check if an image is ready + +- Success return bool +*/ +int ltextureIsImageReady( lua_State *L ) { + Image *image = uluaGetImage( L, 1 ); + + lua_pushboolean( L, IsImageReady( *image ) ); + + return 1; +} + +/* +> RL.UnloadImage( Image image ) + +Unload image from CPU memory (RAM) +*/ +int ltextureUnloadImage( lua_State *L ) { + Image *image = uluaGetImage( L, 1 ); + + UnloadImage( *image ); + + return 0; +} + /* > success = RL.ExportImage( Image image, string fileName ) @@ -1041,6 +1069,47 @@ int ltexturesIsTextureReady( lua_State *L ) { return 1; } +/* +> RL.UnloadTexture( Texture texture ) + +Unload texture from GPU memory (VRAM) +*/ +int ltextureUnloadTexture( lua_State *L ) { + Texture *texture = uluaGetTexture( L, 1 ); + + UnloadTexture( *texture ); + + return 0; +} + +/* +> isReady = RL.IsRenderTextureReady( RenderTexture target ) + +Check if a render texture is ready + +- Success return bool +*/ +int ltexturesIsRenderTextureReady( lua_State *L ) { + RenderTexture *target = uluaGetRenderTexture( L, 1 ); + + lua_pushboolean( L, IsRenderTextureReady( *target ) ); + + return 1; +} + +/* +> RL.UnloadRenderTexture( RenderTexture target ) + +Unload render texture from GPU memory (VRAM) +*/ +int ltextureUnloadRenderTexture( lua_State *L ) { + RenderTexture *target = uluaGetRenderTexture( L, 1 ); + + UnloadRenderTexture( *target ); + + return 0; +} + /* > RL.UpdateTexture( Texture texture, int{} pixels ) -- cgit v1.2.3