summaryrefslogtreecommitdiff
path: root/src/textures.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/textures.c')
-rw-r--r--src/textures.c29
1 files changed, 8 insertions, 21 deletions
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;
}
/*