summaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
authorjussi2023-10-30 22:40:20 +0200
committerjussi2023-10-30 22:40:20 +0200
commitc3295e014d979c0213b3fb7e4837b5356bc8fdb4 (patch)
tree66ee22c7140761a17bf174d71fecfb94c1378b1d /src/text.c
parent6e0d577d63b221797cdc7f392718dd1c4fb384b4 (diff)
downloadreilua-enhanced-c3295e014d979c0213b3fb7e4837b5356bc8fdb4.tar.gz
reilua-enhanced-c3295e014d979c0213b3fb7e4837b5356bc8fdb4.tar.bz2
reilua-enhanced-c3295e014d979c0213b3fb7e4837b5356bc8fdb4.zip
Reintroducing Unload functions. Is*Ready functions. GC_UNLOAD setting and check function.
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c37
1 files changed, 33 insertions, 4 deletions
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;
}
@@ -97,6 +97,34 @@ int ltextLoadFontFromImage( lua_State *L ) {
}
/*
+> 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;
}