From 0df40e2ac080364bcebd4fe0445b814230545477 Mon Sep 17 00:00:00 2001 From: jussi Date: Sun, 29 Oct 2023 15:21:10 +0200 Subject: Shapes, RLGL, Math, Gui and Easings to new style. --- src/textures.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'src/textures.c') diff --git a/src/textures.c b/src/textures.c index 2ebf9cb..aa78ce8 100644 --- a/src/textures.c +++ b/src/textures.c @@ -276,30 +276,17 @@ int ltexturesImageFromImage( lua_State *L ) { Create an image from text (custom sprite font) -- Failure return -1 -- Success return int +- Success return Image */ int ltexturesImageText( lua_State *L ) { - // if ( !lua_isnumber( L, 1 ) || !lua_isstring( L, 2 ) || !lua_isnumber( L, 3 ) - // || !lua_isnumber( L, 4 ) || !lua_istable( L, 5 ) ) { - // TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ImageText( Font font, string text, float fontSize, float spacing, Color tint )" ); - // lua_pushinteger( L, -1 ); - // return 1; - // } - // size_t fontId = lua_tointeger( L, 1 ); - // float fontSize = lua_tonumber( L, 3 ); - // float spacing = lua_tonumber( L, 4 ); - // Color tint = uluaGetColorIndex( L, 5 ); - - // if ( !validFont( fontId ) ) { - // lua_pushinteger( L, -1 ); - // return 1; - // } - // int i = newImage(); - // *state->images[i] = ImageTextEx( *state->fonts[ fontId ], lua_tostring( L, 2 ), fontSize, spacing, tint ); - // lua_pushinteger( L, i ); + Font *font = luaL_checkudata( L, 1, "Font" ); + float fontSize = lua_tonumber( L, 3 ); + float spacing = lua_tonumber( L, 4 ); + Color tint = uluaGetColorIndex( L, 5 ); - return 0; + uluaPushImage( L, ImageTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing, tint ) ); + + return 1; } /* -- cgit v1.2.3