From af03c7364ea0dfe2c8bb269eb8a8f9b580f39633 Mon Sep 17 00:00:00 2001 From: jussi Date: Sat, 28 Oct 2023 14:15:20 +0300 Subject: New object type Font. --- src/rgui.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/rgui.c') diff --git a/src/rgui.c b/src/rgui.c index fe2806d..2a8e290 100644 --- a/src/rgui.c +++ b/src/rgui.c @@ -129,26 +129,16 @@ int lguiGuiGetState( lua_State *L ) { */ /* -> success = RL.GuiSetFont( Font font ) +> RL.GuiSetFont( Font font ) -Set gui custom font ( global state ) - -- Failure return false -- Success return true +Set gui custom font (global state) */ int lguiGuiSetFont( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GuiSetFont( Font font )" ); - lua_pushboolean( L, false ); - return 1; - } - size_t fontId = lua_tointeger( L, 1 ); - state->guiFont = fontId; + Font *font = luaL_checkudata( L, 1, "Font" ); - GuiSetFont( *state->fonts[ fontId ] ); - lua_pushboolean( L, true ); + GuiSetFont( *font ); - return 1; + return 0; } /* @@ -159,7 +149,7 @@ Get gui custom font ( global state ) - Success return int */ int lguiGuiGetFont( lua_State *L ) { - lua_pushinteger( L, state->guiFont ); + uluaPushFont( L, GuiGetFont() ); return 1; } -- cgit v1.2.3