diff options
| author | jussi | 2023-02-06 23:03:39 +0200 |
|---|---|---|
| committer | jussi | 2023-02-06 23:03:39 +0200 |
| commit | db957a8181497a25e52328882e6e0f98d6551d0b (patch) | |
| tree | 583aa051b304c04457d8eba4e7ec238c04b5dcd7 /src/text.c | |
| parent | 7e61bffe5f313599423ad3cf88b0e44329de7dd2 (diff) | |
| download | reilua-enhanced-db957a8181497a25e52328882e6e0f98d6551d0b.tar.gz reilua-enhanced-db957a8181497a25e52328882e6e0f98d6551d0b.tar.bz2 reilua-enhanced-db957a8181497a25e52328882e6e0f98d6551d0b.zip | |
RL_LoadFontEx.
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -63,6 +63,35 @@ int ltextLoadFont( lua_State *L ) { } /* +> font = RL_LoadFontEx( string fileName, int fontSize ) + +Load font from file with extended parameters. Loading the default character set + +- Failure return -1 +- Success return int +*/ +int ltextLoadFontEx( lua_State *L ) { + if ( !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadFontEx( string fileName, int fontSize )" ); + lua_pushinteger( L, -1 ); + return 1; + } + int i = 0; + + for ( i = 0; i < state->fontCount; i++ ) { + if ( state->fonts[i] == NULL ) { + break; + } + } + state->fonts[i] = malloc( sizeof( Font ) ); + *state->fonts[i] = LoadFontEx( lua_tostring( L, -2 ), lua_tointeger( L, - 1 ), NULL, 0 ); + lua_pushinteger( L, i ); + checkFontRealloc( i ); + + return 1; +} + +/* > font = RL_LoadFontFromImage( Image image, Color key, int firstChar ) Load font from Image ( XNA style ) |
