diff options
| author | Indrajith K L | 2025-11-03 17:48:56 +0530 |
|---|---|---|
| committer | Indrajith K L | 2025-11-03 17:48:56 +0530 |
| commit | 737214b71be8fe5fdf51155ad50bb064b3156bd3 (patch) | |
| tree | 21a2713d03830b21ee2b3ffd919708b054728e40 /src/core.c | |
| parent | 3afcbd32001fc2ab2dcee1553268dbb39dabf070 (diff) | |
| download | reilua-enhanced-737214b71be8fe5fdf51155ad50bb064b3156bd3.tar.gz reilua-enhanced-737214b71be8fe5fdf51155ad50bb064b3156bd3.tar.bz2 reilua-enhanced-737214b71be8fe5fdf51155ad50bb064b3156bd3.zip | |
Add embedded assets, splash screens, and asset loading support
Features added:
- Embedded main.lua and Lua files support (EMBED_MAIN option)
- Embedded assets support (EMBED_ASSETS option)
- Splash screens with dual logo display (always embedded)
- Asset loading progress tracking API (BeginAssetLoading, UpdateAssetLoading, EndAssetLoading)
- Custom font embedding for splash/loading screens
- --log flag for Windows console control
- --no-logo flag to skip splash screens in development
- Python scripts for embedding (embed_lua.py, embed_assets.py, embed_logo.py, embed_font.py)
- Documentation (EMBEDDING.md, ASSET_LOADING.md, SPLASH_SCREENS.md)
This allows building single-executable releases with all Lua code and assets embedded.
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 61 |
1 files changed, 61 insertions, 0 deletions
@@ -4,6 +4,14 @@ #include "textures.h" #include "lua_core.h" +/* Forward declarations from lua_core.c for asset loading */ +extern int g_totalAssets; +extern int g_loadedAssets; +extern char g_currentAssetName[256]; +extern bool g_showLoadingScreen; +extern float g_loadingProgress; +extern void drawLoadingScreen(); + static size_t getBufferElementSize( Buffer* buffer ) { switch ( buffer->type ) { case BUFFER_UNSIGNED_CHAR: return sizeof( unsigned char ); @@ -1956,6 +1964,59 @@ int lcoreGetApplicationDirectory( lua_State* L ) { } /* +> RL.BeginAssetLoading( int totalAssets ) + +Initialize asset loading progress tracking + +- totalAssets: Total number of assets to load +*/ +int lcoreBeginAssetLoading( lua_State* L ) { + g_totalAssets = luaL_checkinteger( L, 1 ); + g_loadedAssets = 0; + g_showLoadingScreen = true; + g_loadingProgress = 0.0f; + g_currentAssetName[0] = '\0'; + + return 0; +} + +/* +> RL.UpdateAssetLoading( string assetName ) + +Update loading progress for current asset + +- assetName: Name of the asset currently being loaded +*/ +int lcoreUpdateAssetLoading( lua_State* L ) { + const char* assetName = luaL_checkstring( L, 1 ); + strncpy( g_currentAssetName, assetName, sizeof(g_currentAssetName) - 1 ); + g_currentAssetName[sizeof(g_currentAssetName) - 1] = '\0'; + + g_loadedAssets++; + g_loadingProgress = (float)g_loadedAssets / (float)g_totalAssets; + + if ( g_showLoadingScreen ) { + drawLoadingScreen(); + } + + return 0; +} + +/* +> RL.EndAssetLoading() + +Finish asset loading and hide loading screen +*/ +int lcoreEndAssetLoading( lua_State* L ) { + g_showLoadingScreen = false; + g_totalAssets = 0; + g_loadedAssets = 0; + g_currentAssetName[0] = '\0'; + + return 0; +} + +/* > success = RL.MakeDirectory( string dirPath ) Create directories (including full path requested), returns 0 on success |
