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/text.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'src/text.c') diff --git a/src/text.c b/src/text.c index 1a8f0fd..e2135d1 100644 --- a/src/text.c +++ b/src/text.c @@ -11,10 +11,10 @@ /* > RL.GetFontDefault() -Get the default Font +Get the default Font. Return as lightuserdata */ int ltextGetFontDefault( lua_State *L ) { - uluaPushFont( L, GetFontDefault() ); + lua_pushlightuserdata( L, &state->defaultFont ); return 1; } @@ -96,6 +96,34 @@ int ltextLoadFontFromImage( lua_State *L ) { return 1; } +/* +> isReady = RL.IsFontReady( Font font ) + +Check if a font is ready + +- Success return bool +*/ +int ltextIsFontReady( lua_State *L ) { + Font *font = uluaGetFont( L, 1 ); + + lua_pushboolean( L, IsFontReady( *font ) ); + + return 1; +} + +/* +> RL.UnloadFont( Font font ) + +Unload font from GPU memory (VRAM) +*/ +int ltextUnloadFont( lua_State *L ) { + Font *font = uluaGetFont( L, 1 ); + + UnloadFont( *font ); + + return 0; +} + /* ## Text - Draw */ @@ -218,14 +246,15 @@ int ltextGetFontGlyphPadding( lua_State *L ) { /* > texture = RL.GetFontTexture( Font font ) -Get font texture atlas containing the glyphs. +Get font texture atlas containing the glyphs. Returns as lightuserdata - Success return Texture */ int ltextGetFontTexture( lua_State *L ) { Font *font = uluaGetFont( L, 1 ); - uluaPushTexture( L, font->texture ); + // uluaPushTexture( L, font->texture ); + lua_pushlightuserdata( L, &font->texture ); return 1; } -- cgit v1.2.3