- Move window initialization and font loading to stateInit() - Window now opens before splash screens (required for rendering) - Custom font loaded in stateInit for splash screen use - Remove RL.config() call from luaCallMain() (window already initialized) - Remove stateContextInit() call (initialization now done in stateInit) - Add hasWindow, customFontLoaded, resolution fields to State - Fix memory management for custom font in stateFree() This matches the ReiLua-JamVersion architecture where the window is opened early so splash screens can render properly.
4.7 KiB
4.7 KiB
ReiLua Embedded Assets Upgrade - Summary
Overview
Successfully ported embedded assets, splash screens, and asset loading features from ReiLua-JamVersion to the main ReiLua repository on the embedded-assets-support branch.
Features Added
1. Embedded Main.lua Support (EMBED_MAIN)
- Allows embedding all Lua files from the build directory into the executable
- Custom Lua loader that checks embedded files first before filesystem
- CMake option:
-DEMBED_MAIN=ON - All
.luafiles inbuild/directory are embedded when enabled - Supports
require()for embedded Lua modules
2. Embedded Assets Support (EMBED_ASSETS)
- Embed any asset files (images, sounds, fonts, etc.) into executable
- Assets from
build/assets/directory and subdirectories are embedded - CMake option:
-DEMBED_ASSETS=ON - Preserves directory structure:
build/assets/player.png→ load as"assets/player.png" - Transparent to Lua code - same paths work in dev and release
3. Splash Screens
- Always embedded dual logo splash screens
- Screen 1: "INDRAJITH MAKES GAMES" on Raylib red background
- Screen 2: "Made using" with Raylib and ReiLua logos
- Each screen: 0.8s fade in, 2.5s display, 0.8s fade out
--no-logoflag to skip in development- Logo files always embedded for consistency
4. Asset Loading Progress API
RL.BeginAssetLoading(totalAssets)- Initialize loading trackingRL.UpdateAssetLoading(assetName)- Update progress and show loading screenRL.EndAssetLoading()- Finish loading- Beautiful 1-bit pixel art loading screen with:
- Animated "LOADING" text with dots
- Progress bar with retro dithering pattern
- Progress counter (e.g., "3/10")
- Current asset name display
- Pixel art corner decorations
5. Console Control (Windows)
--logflag to show console window for debugging- By default runs without console for clean UX
- Uses Windows API to dynamically show/hide console
6. Font Embedding
- Custom Oleaguid font always embedded for splash/loading screens
- Ensures consistent appearance across builds
Files Added/Modified
New Files
-
Python Scripts:
embed_lua.py- Embeds Lua files into C headerembed_assets.py- Embeds asset files into C headerembed_logo.py- Embeds splash screen logosembed_font.py- Embeds custom font
-
Source Files:
src/splash.c- Splash screen implementationinclude/splash.h- Splash screen header
-
Assets:
logo/raylib_logo.png- Raylib logo (2466 bytes)logo/reilua_logo.png- ReiLua logo (1191 bytes)fonts/Oleaguid.ttf- Custom font (112828 bytes)
-
Documentation:
EMBEDDING.md- Complete guide to embedding Lua and assetsASSET_LOADING.md- Asset loading API documentationSPLASH_SCREENS.md- Splash screen customization guide
Modified Files
CMakeLists.txt- Added embedding options and build commandssrc/main.c- Added splash screens, console control, --no-logo flagsrc/lua_core.c- Added embedded file loading, asset loading API, loading screensrc/core.c- Added asset loading API functionsinclude/core.h- Added asset loading function declarationsinclude/lua_core.h- Changed luaCallMain() return type to bool
Build Options
Development Build (Fast Iteration)
cmake -G "MinGW Makefiles" ..
mingw32-make
- External Lua and asset files
- Fast edit-and-run workflow
- Use
--no-logoto skip splash screens
Release Build (Single Executable)
# Copy Lua files and assets to build directory
copy ..\*.lua .
mkdir assets
copy ..\assets\* assets\
# Configure with embedding
cmake -G "MinGW Makefiles" .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
mingw32-make
- Everything embedded in single .exe
- Professional distribution package
- No external file dependencies
Command Line Options
ReiLua [Options] [Directory to main.lua or main]
Options:
-h, --help Show help message
-v, --version Show ReiLua version
-i, --interpret Interpret mode [File name]
--log Show console window for logging (Windows only)
--no-logo Skip splash screens (development)
Testing
✅ Build compiles successfully ✅ Logos and font embedded automatically ✅ Asset loading API functions registered ✅ Splash screens implemented ✅ Console control working (Windows) ✅ Documentation complete
Next Steps
- Test with actual embedded Lua files
- Test with embedded assets
- Verify asset loading progress display
- Test splash screens (run without --no-logo)
- Create example game that uses all features
- Merge to main branch when stable
Commit
- Branch:
embedded-assets-support - Commit: "Add embedded assets, splash screens, and asset loading support"
- All changes committed successfully