diff options
| author | jussi | 2023-10-29 13:21:42 +0200 |
|---|---|---|
| committer | jussi | 2023-10-29 13:21:42 +0200 |
| commit | 76911d45a879838047b2845cd6124e9ca3af083a (patch) | |
| tree | 2ff82956451818faaa8956fa2af543fc32646a03 /src/textures.c | |
| parent | fd49d806cf1f54fb86c3ed7b9db499f473a3ef1d (diff) | |
| download | reilua-enhanced-76911d45a879838047b2845cd6124e9ca3af083a.tar.gz reilua-enhanced-76911d45a879838047b2845cd6124e9ca3af083a.tar.bz2 reilua-enhanced-76911d45a879838047b2845cd6124e9ca3af083a.zip | |
New object types for all types.
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/textures.c b/src/textures.c index a66902d..2ebf9cb 100644 --- a/src/textures.c +++ b/src/textures.c @@ -831,35 +831,21 @@ int ltexturesImageDraw( lua_State *L ) { } /* -> success = RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint ) +> RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint ) -Draw text ( Custom sprite font ) within an image ( Destination ) - -- Failure return false -- Success return true +Draw text (Custom sprite font) within an image (Destination) */ int ltexturesImageDrawTextEx( lua_State *L ) { - // if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isstring( L, 3 ) || !lua_istable( L, 4 ) - // || !lua_isnumber( L, 5 ) || !lua_isnumber( L, 6 ) || !lua_istable( L, 7 ) ) { - // TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )" ); - // lua_pushboolean( L, false ); - // return 1; - // } - // size_t imageId = lua_tointeger( L, 1 ); - // size_t fontId = lua_tointeger( L, 2 ); - // Vector2 position = uluaGetVector2Index( L, 4 ); - // float fontSize = lua_tonumber( L, 5 ); - // float spacing = lua_tonumber( L, 6 ); - // Color tint = uluaGetColorIndex( L, 7 ); - - // if ( !validImage( imageId ) || !validFont( fontId ) ) { - // lua_pushboolean( L, false ); - // return 1; - // } - // ImageDrawTextEx( state->images[ imageId ], *state->fonts[ fontId ], lua_tostring( L, 3 ), position, fontSize, spacing, tint ); - // lua_pushboolean( L, true ); + Image *image = luaL_checkudata( L, 1, "Image" ); + Font *font = luaL_checkudata( L, 2, "Font" ); + Vector2 position = uluaGetVector2Index( L, 4 ); + float fontSize = luaL_checknumber( L, 5 ); + float spacing = luaL_checknumber( L, 6 ); + Color tint = uluaGetColorIndex( L, 7 ); - return 1; + ImageDrawTextEx( image, *font, luaL_checkstring( L, 3 ), position, fontSize, spacing, tint ); + + return 0; } /* |
