Changes Docs Folders
This commit is contained in:
13269
docs/API.md
13269
docs/API.md
File diff suppressed because it is too large
Load Diff
@@ -1,266 +0,0 @@
|
||||
# Asset Loading System
|
||||
|
||||
ReiLua includes a built-in asset loading system with a loading screen UI that shows progress while assets are being loaded.
|
||||
|
||||
## Features
|
||||
|
||||
- Automatic Progress Tracking - Tracks how many assets have been loaded
|
||||
- Loading UI with:
|
||||
- Animated "Loading..." text with dots
|
||||
- Smooth progress bar with shimmer effect
|
||||
- Progress percentage (e.g., "3 / 10")
|
||||
- Current asset name being loaded
|
||||
- Easy to Use - Just 3 functions to show loading progress
|
||||
- Works in development and release builds
|
||||
|
||||
## API Functions
|
||||
|
||||
### RL.BeginAssetLoading(totalAssets)
|
||||
|
||||
Initialize asset loading progress tracking and show the loading screen.
|
||||
|
||||
Parameters:
|
||||
- `totalAssets` (integer) - Total number of assets to load
|
||||
|
||||
Example:
|
||||
```lua
|
||||
RL.BeginAssetLoading(10) -- We're loading 10 assets
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### RL.UpdateAssetLoading(assetName)
|
||||
|
||||
Update the loading progress and display current asset being loaded.
|
||||
|
||||
Parameters:
|
||||
- `assetName` (string) - Name of the asset currently being loaded
|
||||
|
||||
Example:
|
||||
```lua
|
||||
RL.UpdateAssetLoading("player.png")
|
||||
```
|
||||
|
||||
Call this **after** each asset is loaded to update the progress bar.
|
||||
|
||||
---
|
||||
|
||||
### RL.EndAssetLoading()
|
||||
|
||||
Finish asset loading and hide the loading screen.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
## Quick Example
|
||||
|
||||
```lua
|
||||
function RL.init()
|
||||
-- List of assets to load
|
||||
local assetsToLoad = {
|
||||
"assets/player.png",
|
||||
"assets/enemy.png",
|
||||
"assets/background.png",
|
||||
"assets/music.wav",
|
||||
}
|
||||
|
||||
-- Begin loading
|
||||
RL.BeginAssetLoading(#assetsToLoad)
|
||||
|
||||
-- Load each asset
|
||||
for i, path in ipairs(assetsToLoad) do
|
||||
RL.UpdateAssetLoading(path) -- Update progress
|
||||
|
||||
-- Load the actual asset
|
||||
if path:match("%.png$") or path:match("%.jpg$") then
|
||||
textures[i] = RL.LoadTexture(path)
|
||||
elseif path:match("%.wav$") or path:match("%.ogg$") then
|
||||
sounds[i] = RL.LoadSound(path)
|
||||
end
|
||||
end
|
||||
|
||||
-- Done!
|
||||
RL.EndAssetLoading()
|
||||
end
|
||||
```
|
||||
|
||||
## Complete Example
|
||||
|
||||
```lua
|
||||
local assets = {}
|
||||
|
||||
local assetsToLoad = {
|
||||
{type="texture", name="player", path="assets/player.png"},
|
||||
{type="texture", name="enemy", path="assets/enemy.png"},
|
||||
{type="texture", name="background", path="assets/background.png"},
|
||||
{type="sound", name="music", path="assets/music.wav"},
|
||||
{type="sound", name="shoot", path="assets/shoot.wav"},
|
||||
{type="font", name="title", path="assets/title.ttf"},
|
||||
}
|
||||
|
||||
function RL.init()
|
||||
RL.SetWindowTitle("My Game")
|
||||
|
||||
-- Start loading with progress
|
||||
RL.BeginAssetLoading(#assetsToLoad)
|
||||
|
||||
-- Load all assets
|
||||
for i, asset in ipairs(assetsToLoad) do
|
||||
-- Show current asset name on loading screen
|
||||
RL.UpdateAssetLoading(asset.name)
|
||||
|
||||
-- Load based on type
|
||||
if asset.type == "texture" then
|
||||
assets[asset.name] = RL.LoadTexture(asset.path)
|
||||
elseif asset.type == "sound" then
|
||||
assets[asset.name] = RL.LoadSound(asset.path)
|
||||
elseif asset.type == "font" then
|
||||
assets[asset.name] = RL.LoadFont(asset.path)
|
||||
end
|
||||
end
|
||||
|
||||
-- Loading complete!
|
||||
RL.EndAssetLoading()
|
||||
|
||||
print("Game ready!")
|
||||
end
|
||||
|
||||
function RL.update(delta)
|
||||
-- Your game logic
|
||||
end
|
||||
|
||||
function RL.draw()
|
||||
RL.ClearBackground(RL.RAYWHITE)
|
||||
|
||||
-- Use loaded assets
|
||||
if assets.background then
|
||||
RL.DrawTexture(assets.background, {0, 0}, RL.WHITE)
|
||||
end
|
||||
|
||||
if assets.player then
|
||||
RL.DrawTexture(assets.player, {100, 100}, RL.WHITE)
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## Loading Screen Appearance
|
||||
|
||||
The loading screen features a clean 1-bit pixel art style:
|
||||
|
||||
Design:
|
||||
- Pure black and white aesthetic
|
||||
- Retro pixel art styling
|
||||
- Minimal and clean design
|
||||
|
||||
Elements:
|
||||
- **Title**: "LOADING" in bold white pixel text
|
||||
- **Animated Dots**: White pixelated dots (4x4 squares) that cycle
|
||||
- **Progress Bar**:
|
||||
- 200px wide, 16px tall
|
||||
- Thick 2px white border (pixel art style)
|
||||
- White fill with black dithering pattern
|
||||
- Retro/Classic terminal aesthetic
|
||||
- **Progress Text**: "3/10" in white pixel font style
|
||||
- **Asset Name**: Current loading asset in small white text
|
||||
- **Corner Decorations**: White pixel art L-shaped corners in all 4 corners
|
||||
|
||||
Background:
|
||||
- Pure black background (#000000)
|
||||
- High contrast for maximum clarity
|
||||
|
||||
Color Palette:
|
||||
- White text and UI (#FFFFFF)
|
||||
- Black background (#000000)
|
||||
- Pure 1-bit aesthetic (inverted terminal style)
|
||||
|
||||
Style Inspiration:
|
||||
- Classic terminal / console aesthetic
|
||||
- MS-DOS loading screens
|
||||
- 1-bit dithering patterns
|
||||
- Chunky pixel borders
|
||||
- Retro computing / CRT monitor style
|
||||
|
||||
## Customization
|
||||
|
||||
If you want to customize the loading screen appearance, you can modify the colors and sizes in `src/lua_core.c` in the `drawLoadingScreen()` function.
|
||||
|
||||
## Performance Tips
|
||||
|
||||
1. **Call UpdateAssetLoading AFTER loading** - This ensures the progress updates at the right time
|
||||
2. **Load assets in order of importance** - Load critical assets first
|
||||
3. **Group similar assets** - Load all textures, then sounds, etc.
|
||||
4. **Use descriptive names** - Shows better feedback to users
|
||||
|
||||
## Example Asset Loading Patterns
|
||||
|
||||
### Pattern 1: Simple List
|
||||
```lua
|
||||
local files = {"player.png", "enemy.png", "music.wav"}
|
||||
RL.BeginAssetLoading(#files)
|
||||
for i, file in ipairs(files) do
|
||||
RL.UpdateAssetLoading(file)
|
||||
-- load file
|
||||
end
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
### Pattern 2: With Types
|
||||
```lua
|
||||
local assets = {
|
||||
textures = {"player.png", "enemy.png"},
|
||||
sounds = {"music.wav", "shoot.wav"},
|
||||
}
|
||||
local total = #assets.textures + #assets.sounds
|
||||
|
||||
RL.BeginAssetLoading(total)
|
||||
for _, file in ipairs(assets.textures) do
|
||||
RL.UpdateAssetLoading(file)
|
||||
-- load texture
|
||||
end
|
||||
for _, file in ipairs(assets.sounds) do
|
||||
RL.UpdateAssetLoading(file)
|
||||
-- load sound
|
||||
end
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
### Pattern 3: Error Handling
|
||||
```lua
|
||||
RL.BeginAssetLoading(#files)
|
||||
for i, file in ipairs(files) do
|
||||
RL.UpdateAssetLoading(file)
|
||||
|
||||
if RL.FileExists(file) then
|
||||
-- load file
|
||||
else
|
||||
print("Warning: " .. file .. " not found")
|
||||
end
|
||||
end
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
## When to Use
|
||||
|
||||
Use the loading system when:
|
||||
- You have more than 5-10 assets to load
|
||||
- Assets are large (images, sounds, fonts)
|
||||
- Loading might take more than 1 second
|
||||
- You want polished loading feedback
|
||||
|
||||
You can skip it when:
|
||||
- You have very few, small assets
|
||||
- Loading is nearly instant
|
||||
- You prefer immediate game start
|
||||
|
||||
## ✨ Benefits
|
||||
|
||||
- Polished user experience
|
||||
- User knows the game is loading, not frozen
|
||||
- Shows progress for large asset sets
|
||||
- Works with embedded assets
|
||||
- Minimal code required
|
||||
- Beautiful default UI
|
||||
|
||||
The loading system makes your game feel polished with just a few lines of code!
|
||||
@@ -1,213 +0,0 @@
|
||||
# Build Scripts Documentation
|
||||
|
||||
ReiLua includes automated build scripts for easy development and release builds.
|
||||
|
||||
## Available Scripts
|
||||
|
||||
### Development Build Scripts
|
||||
- **Windows**: `scripts\build_dev.bat`
|
||||
- **Linux/Unix**: `scripts/build_dev.sh`
|
||||
|
||||
### Release Build Scripts
|
||||
- **Windows**: `scripts\build_release.bat`
|
||||
- **Linux/Unix**: `scripts/build_release.sh`
|
||||
|
||||
## Development Build
|
||||
|
||||
### Purpose
|
||||
Fast iteration during game development with external Lua files and assets.
|
||||
|
||||
### Usage
|
||||
|
||||
Windows:
|
||||
```cmd
|
||||
scripts\build_dev.bat
|
||||
```
|
||||
|
||||
Linux/Unix:
|
||||
```bash
|
||||
chmod +x scripts/build_dev.sh
|
||||
scripts/build_dev.sh
|
||||
```
|
||||
|
||||
### Features
|
||||
- No embedding - loads Lua and assets from file system
|
||||
- Fast build times
|
||||
- Edit code and assets without rebuilding
|
||||
- Automatic cleanup of embedded files
|
||||
- Warns if Lua files or assets are in build directory
|
||||
- Optional clean build: `scripts\build_dev.bat clean` or `scripts/build_dev.sh clean`
|
||||
|
||||
### Output
|
||||
- Development executable: `build/ReiLua.exe`
|
||||
- Run your game: `cd your_game && path/to/build/ReiLua.exe`
|
||||
- Debug mode: `path/to/build/ReiLua.exe --log`
|
||||
|
||||
## Release Build
|
||||
|
||||
### Purpose
|
||||
Create a single-file executable for distribution with all code and assets embedded.
|
||||
|
||||
### Preparation
|
||||
|
||||
Before running the release build, prepare your files:
|
||||
|
||||
```bash
|
||||
cd build
|
||||
|
||||
# Copy all Lua files
|
||||
copy ..\your_game\*.lua .
|
||||
# Or: cp ../your_game/*.lua .
|
||||
|
||||
# Copy assets
|
||||
mkdir assets
|
||||
copy ..\your_game\assets\* assets\
|
||||
# Or: cp -r ../your_game/assets/* assets/
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Windows:
|
||||
```cmd
|
||||
scripts\build_release.bat
|
||||
```
|
||||
|
||||
Linux/Unix:
|
||||
```bash
|
||||
chmod +x scripts/build_release.sh
|
||||
scripts/build_release.sh
|
||||
```
|
||||
|
||||
### Features
|
||||
- Embeds all Lua files from `build/` directory
|
||||
- Embeds all assets from `build/assets/` folder
|
||||
- Creates single-file executable
|
||||
- Release optimization enabled
|
||||
- Verifies Lua files and assets before building
|
||||
- Shows summary of embedded files after build
|
||||
- Interactive confirmation before building
|
||||
|
||||
### Output
|
||||
- Release executable: `build/ReiLua.exe`
|
||||
- Ready for distribution - no external dependencies
|
||||
- Can be renamed to your game name
|
||||
|
||||
### Build Configuration
|
||||
|
||||
The release build automatically configures:
|
||||
- `EMBED_MAIN=ON` - Embeds all Lua files
|
||||
- `EMBED_ASSETS=ON` - Embeds all assets (if assets folder exists)
|
||||
- `CMAKE_BUILD_TYPE=Release` - Optimized build
|
||||
|
||||
## Customizing Your Executable
|
||||
|
||||
### Adding Custom Icon
|
||||
|
||||
1. Replace `icon.ico` with your own icon file
|
||||
2. Keep the same filename or update `resources.rc`
|
||||
3. Rebuild
|
||||
|
||||
### Changing Executable Properties
|
||||
|
||||
Edit `resources.rc` to customize:
|
||||
|
||||
```rc
|
||||
VALUE "CompanyName", "Your Studio Name"
|
||||
VALUE "FileDescription", "Your Game Description"
|
||||
VALUE "ProductName", "Your Game Name"
|
||||
VALUE "LegalCopyright", "Copyright (C) Your Name, 2025"
|
||||
```
|
||||
|
||||
### Renaming the Executable
|
||||
|
||||
Edit `CMakeLists.txt`:
|
||||
```cmake
|
||||
project( YourGameName ) # Line 6
|
||||
```
|
||||
|
||||
After building, the executable will be named `YourGameName.exe`.
|
||||
|
||||
## Workflow Examples
|
||||
|
||||
### Development Workflow
|
||||
|
||||
```bash
|
||||
# Initial setup
|
||||
scripts\build_dev.bat
|
||||
|
||||
# Edit your Lua files in your game directory
|
||||
# ... make changes ...
|
||||
|
||||
# Just run - no rebuild needed!
|
||||
cd your_game
|
||||
path\to\build\ReiLua.exe
|
||||
|
||||
# If you modify C code, rebuild
|
||||
scripts\build_dev.bat
|
||||
```
|
||||
|
||||
### Release Workflow
|
||||
|
||||
```bash
|
||||
# 1. Prepare files
|
||||
cd build
|
||||
copy ..\your_game\*.lua .
|
||||
mkdir assets
|
||||
copy ..\your_game\assets\* assets\
|
||||
|
||||
# 2. Build release
|
||||
cd ..
|
||||
scripts\build_release.bat
|
||||
|
||||
# 3. Test
|
||||
cd build
|
||||
ReiLua.exe --log
|
||||
|
||||
# 4. Distribute
|
||||
# Copy build\ReiLua.exe to your distribution folder
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "CMake configuration failed"
|
||||
- Ensure CMake is installed and in PATH
|
||||
- Ensure MinGW is installed and in PATH
|
||||
- Check `CMakeLists.txt` exists in parent directory
|
||||
|
||||
### "No Lua files found"
|
||||
- Copy your Lua files to `build/` directory before release build
|
||||
- Ensure `main.lua` exists (required entry point)
|
||||
|
||||
### "Build failed"
|
||||
- Check compiler errors in output
|
||||
- Ensure all dependencies are installed
|
||||
- Try clean build: `scripts\build_dev.bat clean`
|
||||
|
||||
### Development build embedding warning
|
||||
- The dev build script warns if it finds Lua files or assets in build/
|
||||
- These should be removed for development builds
|
||||
- The script offers to remove them automatically
|
||||
|
||||
## Script Features
|
||||
|
||||
### Safety Features
|
||||
- Checks for correct directory before running
|
||||
- Validates required files exist
|
||||
- Warns about potential issues
|
||||
- Interactive confirmations for release builds
|
||||
- Automatic cleanup of old embedded files
|
||||
|
||||
### User Friendly
|
||||
- Clear progress messages
|
||||
- Colored output (where supported)
|
||||
- Helpful error messages
|
||||
- Pause at end to review results
|
||||
- Quick reference commands shown after build
|
||||
|
||||
## Notes
|
||||
|
||||
- Development builds are **much faster** than release builds
|
||||
- Release builds may take longer due to embedding and optimization
|
||||
- Always test your release build before distribution
|
||||
- The scripts work on both Windows (CMD/PowerShell) and Unix shells
|
||||
- On Unix, make scripts executable: `chmod +x build_*.sh`
|
||||
@@ -1,401 +0,0 @@
|
||||
# Customizing Your ReiLua Executable
|
||||
|
||||
This guide explains how to customize the ReiLua executable with your own branding.
|
||||
|
||||
## Overview
|
||||
|
||||
You can customize:
|
||||
- Executable name
|
||||
- Window icon
|
||||
- File properties (company name, version, description, etc.)
|
||||
- Splash screen text and logos
|
||||
- Loading screen appearance
|
||||
|
||||
## Quick Customization Checklist
|
||||
|
||||
- [ ] Change executable name in CMakeLists.txt
|
||||
- [ ] Replace icon.ico with your game icon
|
||||
- [ ] Edit resources.rc with your game information
|
||||
- [ ] Customize splash screens in src/splash.c
|
||||
- [ ] Replace logo images in logo/ folder
|
||||
- [ ] Rebuild the project
|
||||
|
||||
## 1. Changing the Executable Name
|
||||
|
||||
The easiest customization - change "ReiLua.exe" to "YourGame.exe".
|
||||
|
||||
### Steps
|
||||
|
||||
1. Open `CMakeLists.txt`
|
||||
2. Find line 6 (near the top):
|
||||
```cmake
|
||||
project( ReiLua )
|
||||
```
|
||||
3. Change to your game name:
|
||||
```cmake
|
||||
project( MyAwesomeGame )
|
||||
```
|
||||
4. Rebuild:
|
||||
```bash
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
Result: Executable is now named `MyAwesomeGame.exe`
|
||||
|
||||
## 2. Adding a Custom Icon
|
||||
|
||||
Replace the default icon with your game's icon.
|
||||
|
||||
### Requirements
|
||||
|
||||
- **Format**: .ico file (Windows icon format)
|
||||
- **Recommended sizes**: 16x16, 32x32, 48x48, 256x256
|
||||
- **Tools**: Use online converters or tools like IcoFX, GIMP, or Photoshop
|
||||
|
||||
### Steps
|
||||
|
||||
1. Create or convert your image to .ico format
|
||||
2. Replace `icon.ico` in the ReiLua root folder with your icon
|
||||
3. Keep the same filename (`icon.ico`) or update `resources.rc`:
|
||||
```rc
|
||||
IDI_ICON1 ICON "your_icon.ico"
|
||||
```
|
||||
4. Rebuild the project
|
||||
|
||||
**Tip**: Many online tools can convert PNG to ICO:
|
||||
- https://convertio.co/png-ico/
|
||||
- https://www.icoconverter.com/
|
||||
|
||||
## 3. Customizing Executable Properties
|
||||
|
||||
When users right-click your .exe and select "Properties", they see file information. Customize this to show your game details.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Open `resources.rc`
|
||||
2. Find the `VERSIONINFO` section
|
||||
3. Modify these values:
|
||||
|
||||
```rc
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 1,0,0,0 // Change version numbers
|
||||
PRODUCTVERSION 1,0,0,0 // Change product version
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Your Studio Name" // Your company/studio
|
||||
VALUE "FileDescription", "Your Game - An awesome game" // Game description
|
||||
VALUE "FileVersion", "1.0.0.0" // File version string
|
||||
VALUE "InternalName", "YourGame" // Internal name
|
||||
VALUE "LegalCopyright", "Copyright (C) 2025 Your Name" // Copyright notice
|
||||
VALUE "OriginalFilename", "YourGame.exe" // Original filename
|
||||
VALUE "ProductName", "Your Game" // Product name
|
||||
VALUE "ProductVersion", "1.0.0.0" // Product version string
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
```
|
||||
|
||||
### Common Values
|
||||
|
||||
**FileVersion / ProductVersion Format**: Major, Minor, Patch, Build
|
||||
- Example: `1,0,0,0` for version 1.0.0.0
|
||||
- Example: `2,3,1,5` for version 2.3.1.5
|
||||
|
||||
**CompanyName Examples**:
|
||||
- "Your Studio Name"
|
||||
- "Independent Developer"
|
||||
- "Your Name Games"
|
||||
|
||||
**FileDescription**:
|
||||
- Short description users see in file properties
|
||||
- Example: "Space Adventure Game"
|
||||
- Example: "Puzzle Game with Physics"
|
||||
|
||||
**LegalCopyright**:
|
||||
- Standard format: "Copyright (C) Year Your Name"
|
||||
- Example: "Copyright (C) 2025 Indie Studios"
|
||||
|
||||
4. Rebuild the project
|
||||
|
||||
## 4. Customizing Splash Screens
|
||||
|
||||
Change the text and logos that appear when your game starts.
|
||||
|
||||
### Changing Splash Screen Text
|
||||
|
||||
1. Open `src/splash.c`
|
||||
2. Find the splash drawing function (around line 150)
|
||||
3. Change this line:
|
||||
```c
|
||||
const char* text = "YOUR STUDIO NAME";
|
||||
```
|
||||
|
||||
**Style Tips**:
|
||||
- Use ALL CAPS for bold impact
|
||||
- Keep it short (under 30 characters)
|
||||
- Examples: "INDIE STUDIO GAMES", "MADE BY YOUR NAME", "GAME JAM 2025"
|
||||
|
||||
### Changing Splash Screen Logos
|
||||
|
||||
1. Create or find your logos:
|
||||
- **Recommended size**: 256x256 pixels or smaller
|
||||
- **Format**: PNG with transparency
|
||||
- **Style**: Simple, recognizable logos work best
|
||||
|
||||
2. Replace these files:
|
||||
```
|
||||
logo/raylib_logo.png → Your game logo
|
||||
logo/reilua_logo.png → Your studio logo (or keep ReiLua logo as credit)
|
||||
```
|
||||
|
||||
3. Logo sizing:
|
||||
- Logos are automatically scaled to max 200px
|
||||
- They display side-by-side on second splash screen
|
||||
- Maintain aspect ratio
|
||||
|
||||
4. Rebuild the project - logos are automatically embedded
|
||||
|
||||
### Changing Splash Screen Timing
|
||||
|
||||
1. Open `src/splash.c`
|
||||
2. Modify these constants at the top:
|
||||
```c
|
||||
#define FADE_IN_TIME 0.8f // Seconds to fade in (default: 0.8)
|
||||
#define DISPLAY_TIME 2.5f // Seconds fully visible (default: 2.5)
|
||||
#define FADE_OUT_TIME 0.8f // Seconds to fade out (default: 0.8)
|
||||
```
|
||||
|
||||
**Recommendations**:
|
||||
- Keep fade times between 0.5 - 1.5 seconds
|
||||
- Display time between 1.5 - 3.5 seconds
|
||||
- Total splash time ideally under 10 seconds
|
||||
|
||||
### Changing Splash Screen Colors
|
||||
|
||||
1. Open `src/splash.c`
|
||||
2. Find color definitions:
|
||||
```c
|
||||
// First splash screen background (Raylib red)
|
||||
Color bgColor = (Color){ 230, 41, 55, 255 }; // Change these RGB values
|
||||
|
||||
// Second splash screen background (Black)
|
||||
Color bg = BLACK; // Change to any color
|
||||
```
|
||||
|
||||
**Color Examples**:
|
||||
- White: `(Color){ 255, 255, 255, 255 }`
|
||||
- Blue: `(Color){ 0, 120, 215, 255 }`
|
||||
- Dark Gray: `(Color){ 32, 32, 32, 255 }`
|
||||
- Your brand color: `(Color){ R, G, B, 255 }`
|
||||
|
||||
## 5. Customizing the Loading Screen
|
||||
|
||||
Change the appearance of the asset loading screen.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Open `src/lua_core.c`
|
||||
2. Find the `drawLoadingScreen()` function
|
||||
3. Modify colors and style:
|
||||
|
||||
```c
|
||||
// Background color
|
||||
Color bgColor = BLACK; // Change background
|
||||
|
||||
// Text color
|
||||
Color textColor = WHITE; // Change text color
|
||||
|
||||
// Progress bar fill color
|
||||
Color fillColor = WHITE; // Change bar fill
|
||||
|
||||
// Border color
|
||||
Color borderColor = WHITE; // Change borders
|
||||
```
|
||||
|
||||
### Customizing Loading Text
|
||||
|
||||
```c
|
||||
// In drawLoadingScreen() function
|
||||
const char* loadingText = "LOADING"; // Change to "LOADING GAME", etc.
|
||||
```
|
||||
|
||||
### Changing Progress Bar Size
|
||||
|
||||
```c
|
||||
int barWidth = 200; // Default 200px, change as needed
|
||||
int barHeight = 16; // Default 16px, change as needed
|
||||
int borderThick = 2; // Border thickness
|
||||
```
|
||||
|
||||
## 6. Complete Rebranding Example
|
||||
|
||||
Here's a complete example of rebranding ReiLua as "Space Quest":
|
||||
|
||||
### 1. CMakeLists.txt
|
||||
```cmake
|
||||
project( SpaceQuest )
|
||||
```
|
||||
|
||||
### 2. resources.rc
|
||||
```rc
|
||||
VALUE "CompanyName", "Cosmic Games Studio"
|
||||
VALUE "FileDescription", "Space Quest - Explore the Galaxy"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "InternalName", "SpaceQuest"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2025 Cosmic Games"
|
||||
VALUE "OriginalFilename", "SpaceQuest.exe"
|
||||
VALUE "ProductName", "Space Quest"
|
||||
VALUE "ProductVersion", "1.0.0.0"
|
||||
```
|
||||
|
||||
### 3. icon.ico
|
||||
Replace with your space-themed icon
|
||||
|
||||
### 4. src/splash.c
|
||||
```c
|
||||
const char* text = "COSMIC GAMES STUDIO";
|
||||
```
|
||||
|
||||
### 5. logo/ folder
|
||||
```
|
||||
logo/raylib_logo.png → Your game logo (space ship, planet, etc.)
|
||||
logo/reilua_logo.png → Studio logo (keep ReiLua logo for credit)
|
||||
```
|
||||
|
||||
### 6. Build
|
||||
```bash
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
Result: `SpaceQuest.exe` with all your custom branding!
|
||||
|
||||
## 7. Advanced: Removing ReiLua Branding
|
||||
|
||||
If you want to completely remove ReiLua references:
|
||||
|
||||
### Remove "Made with ReiLua" Logo
|
||||
|
||||
1. Open `src/splash.c`
|
||||
2. Find `drawMadeWithSplash()` function
|
||||
3. Comment out or modify the function to only show your logo
|
||||
|
||||
### Remove Second Splash Screen
|
||||
|
||||
1. Open `src/main.c`
|
||||
2. Find the splash screen loop
|
||||
3. Modify to only call your custom splash
|
||||
|
||||
**Note**: Please keep attribution to Raylib and ReiLua in your game's credits or about screen as a courtesy!
|
||||
|
||||
## 8. Build and Test
|
||||
|
||||
After making any customizations:
|
||||
|
||||
```bash
|
||||
# Clean build (recommended after customizations)
|
||||
cd build
|
||||
rm -rf * # Or: rmdir /s /q * on Windows
|
||||
cmake ..
|
||||
cmake --build . --config Release
|
||||
|
||||
# Test with console
|
||||
YourGame.exe --log
|
||||
|
||||
# Test production mode
|
||||
YourGame.exe
|
||||
```
|
||||
|
||||
Verify:
|
||||
- Executable has correct name
|
||||
- Icon appears in file explorer
|
||||
- Right-click → Properties shows correct info
|
||||
- Splash screens display correctly
|
||||
- Loading screen appears as expected
|
||||
|
||||
## Checklist: Release-Ready Customization
|
||||
|
||||
Before releasing your game:
|
||||
|
||||
- [ ] Executable name matches your game
|
||||
- [ ] Custom icon is recognizable at small sizes
|
||||
- [ ] File properties are complete and accurate
|
||||
- [ ] Splash screens show correct studio name
|
||||
- [ ] Logos are high quality and appropriate size
|
||||
- [ ] Loading screen matches your game's aesthetic
|
||||
- [ ] Copyright and legal information is correct
|
||||
- [ ] Version numbers are accurate
|
||||
- [ ] Tested on target platforms
|
||||
- [ ] Credits mention Raylib and ReiLua
|
||||
|
||||
## Tips for Polish
|
||||
|
||||
1. **Consistent Branding**: Use the same colors, fonts, and style across splash screens, loading screen, and in-game UI
|
||||
|
||||
2. **Icon Quality**: Invest time in a good icon - it's the first thing users see
|
||||
|
||||
3. **Version Management**: Update version numbers for each release
|
||||
|
||||
4. **Legal Info**: Always include proper copyright and attribution
|
||||
|
||||
5. **Test Everything**: Test your branded executable on a clean system
|
||||
|
||||
6. **Keep Credits**: Mention Raylib and ReiLua in your game's credits screen
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Icon doesn't change:
|
||||
- Ensure .ico file is valid
|
||||
- Rebuild completely (clean build)
|
||||
- Clear icon cache (Windows): Delete `IconCache.db`
|
||||
|
||||
Properties don't update:
|
||||
- Verify `resources.rc` syntax is correct
|
||||
- Rebuild completely
|
||||
- Check that resource compiler ran (check build output)
|
||||
|
||||
Splash screens don't show changes:
|
||||
- Rebuild with clean build
|
||||
- Check `scripts/embed_logo.py` ran successfully
|
||||
- Verify logo files exist in `logo/` folder
|
||||
|
||||
Executable name unchanged:
|
||||
- Check `CMakeLists.txt` project name
|
||||
- Do a clean rebuild
|
||||
- Verify cmake configuration step succeeded
|
||||
|
||||
## Additional Resources
|
||||
|
||||
### Icon Creation Tools
|
||||
- **IcoFX**: Icon editor (paid)
|
||||
- **GIMP**: Free, supports ICO export
|
||||
- **Online**: convertio.co, icoconverter.com
|
||||
|
||||
### Image Editing
|
||||
- **GIMP**: Free, powerful image editor
|
||||
- **Paint.NET**: Simple, free Windows editor
|
||||
- **Photoshop**: Industry standard (paid)
|
||||
|
||||
### Color Picking
|
||||
- **ColorPicker**: Use system color picker
|
||||
- **HTML Color Codes**: htmlcolorcodes.com
|
||||
- **Adobe Color**: color.adobe.com
|
||||
|
||||
---
|
||||
|
||||
Now your ReiLua executable is fully branded and ready to represent your game!
|
||||
@@ -1,167 +0,0 @@
|
||||
# Documentation Overview
|
||||
|
||||
This document provides a quick reference to all available documentation for ReiLua Enhanced Edition.
|
||||
|
||||
## Core Documentation
|
||||
|
||||
**README.md** - START HERE
|
||||
|
||||
The main documentation covering: what is ReiLua Enhanced Edition, complete attributions (Raylib, ReiLua, enhancements), quick start guide, all enhanced features overview, command line options, building from source (Windows, Linux, Mac, Raspberry Pi, Web), complete release workflow, and troubleshooting.
|
||||
|
||||
Read this first!
|
||||
|
||||
---
|
||||
|
||||
## Feature-Specific Guides
|
||||
|
||||
**SPLASH_SCREENS.md** - Everything about splash screens
|
||||
|
||||
How the dual splash screen system works, custom text splash screen details, "Made using Raylib + ReiLua" screen details, skipping splashes with `--no-logo` flag, customizing text, logos, timing, and colors, technical implementation details, and troubleshooting.
|
||||
|
||||
**EMBEDDING.md** - Complete guide to embedding
|
||||
|
||||
Development vs release workflows, embedding Lua files (`EMBED_MAIN=ON`), embedding assets (`EMBED_ASSETS=ON`), console control with `--log` flag, complete release build workflow, asset path consistency, and troubleshooting.
|
||||
|
||||
**ASSET_LOADING.md** - Asset loading system documentation
|
||||
|
||||
API functions (`BeginAssetLoading`, `UpdateAssetLoading`, `EndAssetLoading`), beautiful 1-bit pixel art loading screen, complete examples, loading patterns, progress tracking, when to use the loading system, and customization options.
|
||||
|
||||
**BUILD_SCRIPTS.md** - Build automation documentation
|
||||
|
||||
`scripts\build_dev.bat` / `scripts/build_dev.sh` for development builds, `scripts\build_release.bat` / `scripts/build_release.sh` for release builds, features of each build type, workflow examples, customizing executable name, icon, and properties, and troubleshooting.
|
||||
|
||||
**CUSTOMIZATION.md** - Complete rebranding guide
|
||||
|
||||
Changing executable name, adding custom icon, customizing file properties (company name, version, etc.), customizing splash screens, customizing loading screen, complete rebranding example, and removing ReiLua branding (with attribution notes).
|
||||
|
||||
**ZED_EDITOR_SETUP.md** - Complete Zed editor setup
|
||||
|
||||
Why Zed for ReiLua development, installation guide, Lua Language Server configuration, project setup with `.zed/settings.json`, task configuration for quick testing, essential keyboard shortcuts, multi-cursor editing, split views, Vim mode, troubleshooting LSP issues, and workflow tips.
|
||||
|
||||
---
|
||||
|
||||
## Technical Documentation
|
||||
|
||||
**API.md** - Complete API reference
|
||||
|
||||
1000+ functions, all ReiLua/Raylib bindings, function signatures, Raygui, Raymath, Lights, Easings, and RLGL modules.
|
||||
|
||||
**tools/ReiLua_API.lua** - Lua annotations file
|
||||
|
||||
Provides autocomplete in LSP-enabled editors, function documentation. Copy to your project for IDE support.
|
||||
|
||||
**UPGRADE_SUMMARY.md** - Technical implementation details
|
||||
|
||||
Features added in this enhanced version, files modified and added, build options explained, testing checklist, and known changes from original ReiLua
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference by Task
|
||||
|
||||
I want to start making a game
|
||||
|
||||
1. Read README.md - Quick Start section
|
||||
2. Look at examples in `examples/` folder
|
||||
3. Use `ReiLua.exe --log --no-logo` for development
|
||||
|
||||
I want to embed my game into a single .exe
|
||||
|
||||
1. Read EMBEDDING.md
|
||||
2. Use `scripts\build_release.bat` / `scripts/build_release.sh`
|
||||
3. Follow the complete release workflow in README.md
|
||||
|
||||
I want to add a loading screen
|
||||
|
||||
1. Read ASSET_LOADING.md
|
||||
2. Use `RL.BeginAssetLoading()`, `RL.UpdateAssetLoading()`, `RL.EndAssetLoading()`
|
||||
3. See complete examples in the guide
|
||||
|
||||
I want to customize splash screens
|
||||
|
||||
1. Read SPLASH_SCREENS.md
|
||||
2. Edit `src/splash.c` for text changes
|
||||
3. Replace logo files in `logo/` folder
|
||||
4. Rebuild project
|
||||
|
||||
I want to rebrand the executable
|
||||
|
||||
1. Read CUSTOMIZATION.md
|
||||
2. Change project name in `CMakeLists.txt`
|
||||
3. Replace `icon.ico`
|
||||
4. Edit `resources.rc`
|
||||
5. Customize splash screens
|
||||
6. Rebuild
|
||||
|
||||
I want to setup my code editor
|
||||
|
||||
1. Read ZED_EDITOR_SETUP.md
|
||||
2. Install Zed and Lua Language Server
|
||||
3. Copy `tools/ReiLua_API.lua` to your project
|
||||
4. Create `.zed/settings.json` configuration
|
||||
5. Set up tasks for quick testing
|
||||
|
||||
I want to build ReiLua from source
|
||||
|
||||
1. Read README.md - Building from Source section
|
||||
2. Install prerequisites (CMake, compiler, Raylib, Lua)
|
||||
3. Use `scripts\build_dev.bat` for development
|
||||
4. Use `scripts\build_release.bat` for release
|
||||
|
||||
I need API reference
|
||||
|
||||
1. Open API.md
|
||||
2. Search for function name
|
||||
3. See function signature and description
|
||||
4. Or copy tools/ReiLua_API.lua for autocomplete
|
||||
|
||||
---
|
||||
|
||||
## Documentation File Sizes
|
||||
|
||||
| File | Size | Purpose |
|
||||
|------|------|---------|
|
||||
| README.md | 21 KB | Main documentation (START HERE) |
|
||||
| ZED_EDITOR_SETUP.md | 13 KB | Editor setup guide |
|
||||
| CUSTOMIZATION.md | 11 KB | Rebranding guide |
|
||||
| ASSET_LOADING.md | 8 KB | Loading system guide |
|
||||
| EMBEDDING.md | 7 KB | Embedding guide |
|
||||
| SPLASH_SCREENS.md | 7 KB | Splash screen guide |
|
||||
| UPGRADE_SUMMARY.md | 6 KB | Technical details |
|
||||
| BUILD_SCRIPTS.md | 5 KB | Build automation guide |
|
||||
| API.md | 207 KB | Complete API reference |
|
||||
|
||||
---
|
||||
|
||||
## Contribution
|
||||
|
||||
When adding new features, please:
|
||||
1. Update relevant documentation
|
||||
2. Add examples where appropriate
|
||||
3. Update this overview if adding new docs
|
||||
4. Test documentation accuracy
|
||||
|
||||
---
|
||||
|
||||
## Documentation Standards
|
||||
|
||||
All documentation follows these standards:
|
||||
- Clear headings and structure
|
||||
- Code examples for all features
|
||||
- Troubleshooting sections
|
||||
- Cross-references to related docs
|
||||
- Platform-specific notes where needed
|
||||
- Complete but concise
|
||||
|
||||
---
|
||||
|
||||
## Quick Links
|
||||
|
||||
- Original ReiLua: https://github.com/Gamerfiend/ReiLua
|
||||
- Raylib: https://github.com/raysan5/raylib
|
||||
- Lua: https://www.lua.org/
|
||||
- Zed Editor: https://zed.dev/
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-03
|
||||
**Documentation Version**: 1.0 (Enhanced Edition)
|
||||
@@ -1,289 +0,0 @@
|
||||
# Embedding main.lua into Executable
|
||||
|
||||
When you're ready to ship your game, you can embed all Lua files and asset files directly into the executable.
|
||||
|
||||
## Development vs Release Workflow
|
||||
|
||||
Development Build (Fast Iteration)
|
||||
|
||||
During development, use external files for quick iteration.
|
||||
|
||||
Setup:
|
||||
```
|
||||
GameFolder/
|
||||
├── ReiLua.exe
|
||||
├── main.lua
|
||||
├── player.lua
|
||||
└── assets/
|
||||
├── player.png
|
||||
└── music.wav
|
||||
```
|
||||
|
||||
Build:
|
||||
```bash
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
Benefits:
|
||||
- Edit Lua files and re-run immediately
|
||||
- Edit assets and reload
|
||||
- Fast development cycle
|
||||
- Debug with `--log` flag
|
||||
|
||||
Release Build (Single Executable)
|
||||
|
||||
For distribution, embed everything into one file.
|
||||
|
||||
Setup:
|
||||
```bash
|
||||
cd build
|
||||
|
||||
# Copy Lua files to build directory
|
||||
copy ..\main.lua .
|
||||
copy ..\player.lua .
|
||||
|
||||
# Create assets folder and copy files
|
||||
mkdir assets
|
||||
copy ..\player.png assets\
|
||||
copy ..\music.wav assets\
|
||||
```
|
||||
|
||||
Build:
|
||||
```bash
|
||||
# Configure with embedding
|
||||
cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
|
||||
|
||||
# Build release
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
Result:
|
||||
```
|
||||
Distribution/
|
||||
└── YourGame.exe (Everything embedded!)
|
||||
```
|
||||
|
||||
Benefits:
|
||||
- Single executable file
|
||||
- No external dependencies
|
||||
- Users can't modify game files
|
||||
- Smaller download (no separate files)
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Embedding Lua Files
|
||||
|
||||
1. **Copy your Lua files to the build directory**:
|
||||
```bash
|
||||
copy main.lua build\main.lua
|
||||
copy player.lua build\player.lua
|
||||
```
|
||||
|
||||
2. **Build with EMBED_MAIN option**:
|
||||
```bash
|
||||
cd build
|
||||
cmake .. -DEMBED_MAIN=ON
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
## Command Line Options
|
||||
|
||||
ReiLua supports several command-line options:
|
||||
|
||||
```bash
|
||||
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)
|
||||
```
|
||||
|
||||
### Console/Logging
|
||||
|
||||
By default, ReiLua runs **without a console window** for a clean user experience. To enable console output for debugging:
|
||||
|
||||
```bash
|
||||
# Run with console for debugging
|
||||
ReiLua.exe --log
|
||||
|
||||
# You can also combine with other options
|
||||
ReiLua.exe --log path/to/game
|
||||
|
||||
# Or with interpret mode
|
||||
ReiLua.exe --log -i script.lua
|
||||
```
|
||||
|
||||
This is useful during development to see:
|
||||
- TraceLog output
|
||||
- Print statements
|
||||
- Lua errors
|
||||
- Debug information
|
||||
|
||||
## Complete Release Workflow
|
||||
|
||||
Here's a complete step-by-step guide to prepare your game for release:
|
||||
|
||||
### Step 1: Organize Your Project
|
||||
|
||||
Ensure your project has this structure:
|
||||
```
|
||||
MyGame/
|
||||
├── main.lua
|
||||
├── player.lua
|
||||
├── enemy.lua
|
||||
├── player.png
|
||||
├── enemy.png
|
||||
├── music.wav
|
||||
└── icon.ico (optional)
|
||||
```
|
||||
|
||||
### Step 2: Customize Branding (Optional)
|
||||
|
||||
Change executable icon:
|
||||
```bash
|
||||
# Replace ReiLua's icon with yours
|
||||
copy MyGame\icon.ico ReiLua\icon.ico
|
||||
```
|
||||
|
||||
Edit executable properties:
|
||||
Open `ReiLua\resources.rc` and modify:
|
||||
```rc
|
||||
VALUE "CompanyName", "Your Studio Name"
|
||||
VALUE "FileDescription", "Your Game Description"
|
||||
VALUE "ProductName", "Your Game Name"
|
||||
VALUE "LegalCopyright", "Copyright (C) Your Name, 2025"
|
||||
```
|
||||
|
||||
Change executable name:
|
||||
Edit `ReiLua\CMakeLists.txt`:
|
||||
```cmake
|
||||
project( YourGameName ) # Change from "ReiLua"
|
||||
```
|
||||
|
||||
See [CUSTOMIZATION.md](CUSTOMIZATION.md) for full details.
|
||||
|
||||
### Important: Asset Paths
|
||||
|
||||
**Keep your paths consistent!** The embedding system now preserves the `assets/` prefix, so use the same paths in both development and release:
|
||||
|
||||
```lua
|
||||
-- Correct - works in both dev and release
|
||||
playerImage = RL.LoadTexture("assets/player.png")
|
||||
backgroundImg = RL.LoadTexture("assets/background.png")
|
||||
musicSound = RL.LoadSound("assets/music.wav")
|
||||
```
|
||||
|
||||
Your Lua code doesn't need to change between development and release builds!
|
||||
|
||||
### Step 3: Prepare Build Directory
|
||||
|
||||
```bash
|
||||
cd ReiLua\build
|
||||
|
||||
# Copy all Lua files
|
||||
copy ..\MyGame\*.lua .
|
||||
|
||||
# Create assets folder
|
||||
mkdir assets
|
||||
|
||||
# Copy all asset files (images, sounds, etc.)
|
||||
copy ..\MyGame\*.png assets\
|
||||
copy ..\MyGame\*.wav assets\
|
||||
copy ..\MyGame\*.ogg assets\
|
||||
# Or copy entire folders
|
||||
xcopy /E /I ..\MyGame\images assets\images
|
||||
xcopy /E /I ..\MyGame\sounds assets\sounds
|
||||
```
|
||||
|
||||
### Step 4: Build Release
|
||||
|
||||
```bash
|
||||
# Configure with embedding enabled
|
||||
cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
|
||||
|
||||
# Build in release mode
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
### Step 5: Test Release Build
|
||||
|
||||
```bash
|
||||
# Test with console to verify everything loaded
|
||||
YourGameName.exe --log
|
||||
|
||||
# Test production mode (no console)
|
||||
YourGameName.exe
|
||||
```
|
||||
|
||||
Check console output for:
|
||||
- "ReiLua x.x.x" version info
|
||||
- No file loading errors
|
||||
- Game runs correctly
|
||||
|
||||
### Step 6: Package for Distribution
|
||||
|
||||
```bash
|
||||
# Create distribution folder
|
||||
mkdir ..\Distribution
|
||||
copy YourGameName.exe ..\Distribution\
|
||||
|
||||
# Optional: Add README, LICENSE, etc.
|
||||
copy ..\README.txt ..\Distribution\
|
||||
```
|
||||
|
||||
Your game is now ready to distribute as a single executable!
|
||||
|
||||
### Workflow Summary
|
||||
|
||||
| Stage | Build Command | Files Needed | Result |
|
||||
|-------|--------------|--------------|--------|
|
||||
| **Development** | `cmake .. && cmake --build .` | Lua + assets external | Fast iteration |
|
||||
| **Testing** | `cmake .. -DEMBED_MAIN=ON && cmake --build .` | Lua in build/ | Test embedding |
|
||||
| **Release** | `cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON && cmake --build . --config Release` | Lua + assets in build/ | Single .exe |
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Problem: "No .lua files found in build directory"
|
||||
```bash
|
||||
# Solution: Copy Lua files to build directory
|
||||
copy ..\*.lua .
|
||||
```
|
||||
|
||||
Problem: "No files found in assets folder"
|
||||
```bash
|
||||
# Solution: Create assets folder and copy files
|
||||
mkdir assets
|
||||
copy ..\*.png assets\
|
||||
```
|
||||
|
||||
Problem: Game crashes on startup
|
||||
```bash
|
||||
# Solution: Run with --log to see error messages
|
||||
YourGameName.exe --log
|
||||
```
|
||||
|
||||
Problem: Assets not loading
|
||||
- Verify assets are in `build/assets/` before building
|
||||
- Check asset filenames match in your Lua code
|
||||
- Use `--log` to see loading errors
|
||||
|
||||
### Notes
|
||||
|
||||
- `.lua` files in the **build directory root** are embedded when using `EMBED_MAIN=ON`
|
||||
- Asset files in **build/assets/** folder (and subfolders) are embedded when using `EMBED_ASSETS=ON`
|
||||
- `main.lua` must exist and is always the entry point
|
||||
- Asset embedding works with subdirectories: `assets/images/player.png` → Load with `LoadImage("player.png")`
|
||||
- Both Lua and asset embedding can be used independently or together
|
||||
- The system falls back to file system if embedded file is not found
|
||||
- No code changes needed - all raylib functions work automatically with embedded assets
|
||||
|
||||
## Customizing Your Executable
|
||||
|
||||
Want to add your own icon and version info to the executable? See [CUSTOMIZATION.md](CUSTOMIZATION.md) for details on:
|
||||
- Adding a custom icon
|
||||
- Setting exe properties (company name, version, description)
|
||||
- Renaming the executable
|
||||
34
docs/README.md
Normal file
34
docs/README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# ReiLua Documentation
|
||||
|
||||
Simple HTML documentation for ReiLua, inspired by the Lua manual style.
|
||||
|
||||
## Contents
|
||||
|
||||
- index.html - Homepage
|
||||
- manual.html - Complete user guide
|
||||
- reference.html - API reference (1924 functions and structures)
|
||||
- style.css - Stylesheet
|
||||
- generate.py - Documentation generator
|
||||
|
||||
## Viewing
|
||||
|
||||
Open index.html in any web browser.
|
||||
|
||||
## Hosting
|
||||
|
||||
Upload the entire html_docs folder to your web server.
|
||||
|
||||
## Regenerating
|
||||
|
||||
If you update the markdown source files, regenerate with:
|
||||
|
||||
cd html_docs
|
||||
python generate.py
|
||||
|
||||
Requires Python 3.
|
||||
|
||||
## Style
|
||||
|
||||
Clean white background with navy blue headers, inspired by the official Lua manual.
|
||||
|
||||
Simple, practical, and easy to read.
|
||||
@@ -1,229 +0,0 @@
|
||||
# Splash Screens
|
||||
|
||||
ReiLua includes a built-in splash screen system that displays splash screens before your game loads. This gives your game a polished appearance right from startup.
|
||||
|
||||
## Overview
|
||||
|
||||
When you run your ReiLua game, it automatically shows two splash screens in sequence:
|
||||
|
||||
1. **Custom Text** - Clean, bold text on Raylib red background (similar to Squid Game style)
|
||||
2. **"Made using"** - Text with Raylib and ReiLua logos displayed side-by-side
|
||||
|
||||
Each splash screen:
|
||||
- Fades in over 0.8 seconds
|
||||
- Displays for 2.5 seconds
|
||||
- Fades out over 0.8 seconds
|
||||
- Total display time: 8.2 seconds for both screens
|
||||
|
||||
## Features
|
||||
|
||||
### Always Embedded
|
||||
|
||||
The logo images are **always embedded** into the executable in both development and release builds. This means:
|
||||
|
||||
- No external logo files needed
|
||||
- Consistent splash screens across all builds
|
||||
- No risk of missing logo files
|
||||
- Clean appearance from the start
|
||||
|
||||
### Asset Loading Integration
|
||||
|
||||
The splash screens display **before** your game's asset loading begins. This means:
|
||||
|
||||
1. User starts your game
|
||||
2. Splash screens play (~8 seconds)
|
||||
3. Your `RL.init()` function runs
|
||||
4. Asset loading with progress indicator (if you use it)
|
||||
5. Your game starts
|
||||
|
||||
This creates a smooth, polished startup experience.
|
||||
|
||||
## Skipping Splash Screens (Development)
|
||||
|
||||
During development, you often need to test your game repeatedly. Waiting for splash screens every time can slow down your workflow. Use the `--no-logo` flag to skip them:
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
ReiLua.exe --no-logo
|
||||
|
||||
# Linux/Mac
|
||||
./ReiLua --no-logo
|
||||
|
||||
# With other options
|
||||
ReiLua.exe --log --no-logo
|
||||
./ReiLua --no-logo path/to/game/
|
||||
```
|
||||
|
||||
**Note:** The `--no-logo` flag only works in development. In release builds, users should see the full splash screen sequence.
|
||||
|
||||
## Technical Details
|
||||
|
||||
### How It Works
|
||||
|
||||
The splash screen system is implemented in C and runs before any Lua code executes:
|
||||
|
||||
1. **Logo Embedding**: During build, `scripts/embed_logo.py` converts PNG files to C byte arrays
|
||||
2. **Initialization**: Before calling `RL.init()`, the engine initializes splash screens
|
||||
3. **Display Loop**: A dedicated loop handles timing, fading, and rendering
|
||||
4. **Cleanup**: After completion, resources are freed and Lua code begins
|
||||
|
||||
### Files
|
||||
|
||||
- `src/splash.c` - Splash screen implementation
|
||||
- `include/splash.h` - Header file
|
||||
- `scripts/embed_logo.py` - Python script to embed logo images
|
||||
- `logo/raylib_logo.png` - Raylib logo (embedded)
|
||||
- `logo/reilua_logo.png` - ReiLua logo (embedded)
|
||||
|
||||
### Build Integration
|
||||
|
||||
The CMakeLists.txt automatically:
|
||||
|
||||
1. Runs `scripts/embed_logo.py` during build
|
||||
2. Generates `embedded_logo.h` with logo data
|
||||
3. Defines `EMBED_LOGO` flag
|
||||
4. Compiles `splash.c` with the project
|
||||
|
||||
No manual steps required - it just works!
|
||||
|
||||
## Customization
|
||||
|
||||
### Changing Splash Screen Text
|
||||
|
||||
To change the default text to your studio name:
|
||||
|
||||
1. Open `src/splash.c`
|
||||
2. Find the splash drawing function
|
||||
3. Change the text line:
|
||||
```c
|
||||
const char* text = "YOUR STUDIO NAME";
|
||||
```
|
||||
4. Rebuild the project
|
||||
|
||||
**Note:** Use ALL CAPS for the Squid Game-style aesthetic.
|
||||
|
||||
### Changing Logos
|
||||
|
||||
To use different logos:
|
||||
|
||||
1. Replace `logo/raylib_logo.png` and/or `logo/reilua_logo.png` with your images
|
||||
2. Recommended size: 256x256 or smaller (logos are auto-scaled to max 200px)
|
||||
3. Format: PNG with transparency support
|
||||
4. Rebuild the project - logos will be automatically embedded
|
||||
|
||||
### Changing Timing
|
||||
|
||||
To adjust how long each screen displays:
|
||||
|
||||
1. Open `src/splash.c`
|
||||
2. Modify these constants at the top:
|
||||
```c
|
||||
#define FADE_IN_TIME 0.8f // Seconds to fade in
|
||||
#define DISPLAY_TIME 2.5f // Seconds to display fully
|
||||
#define FADE_OUT_TIME 0.8f // Seconds to fade out
|
||||
```
|
||||
3. Rebuild the project
|
||||
|
||||
### Removing Splash Screens Entirely
|
||||
|
||||
If you don't want any splash screens:
|
||||
|
||||
1. Open `src/main.c`
|
||||
2. Find this block:
|
||||
```c
|
||||
/* Show splash screens if not skipped */
|
||||
if ( !skip_splash ) {
|
||||
splashInit();
|
||||
// ... splash code ...
|
||||
splashCleanup();
|
||||
}
|
||||
```
|
||||
3. Comment out or remove the entire block
|
||||
4. Rebuild the project
|
||||
|
||||
## Example: Complete Startup Sequence
|
||||
|
||||
Here's what a typical game startup looks like with everything enabled:
|
||||
|
||||
```bash
|
||||
ReiLua.exe MyGame/
|
||||
```
|
||||
|
||||
User Experience:
|
||||
1. **Splash Screen 1** (4.1 seconds)
|
||||
- Custom text displayed in bold (default: "YOUR STUDIO NAME")
|
||||
- Red background (Raylib color #E62937)
|
||||
- Subtle zoom effect
|
||||
|
||||
2. **Splash Screen 2** (4.1 seconds)
|
||||
- "Made using" text at top
|
||||
- Raylib + ReiLua logos side-by-side (max 200px each)
|
||||
- Black background
|
||||
|
||||
3. **Asset Loading** (varies)
|
||||
- Your loading screen with progress bar
|
||||
- Shows "Loading texture1.png", "3/10", etc.
|
||||
|
||||
4. **Game Start**
|
||||
- Your game's main screen appears
|
||||
- Player can interact
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Keep --no-logo for Development**: Always use `--no-logo` during active development
|
||||
2. **Test Without Flag**: Occasionally test without `--no-logo` to ensure splash screens work
|
||||
3. **Customize for Your Studio**: Change the text and logos to match your branding
|
||||
4. **Consider Total Time**: Splash (~8s) + Loading (varies) = Total startup time
|
||||
5. **Optimize Loading**: Keep asset loading fast to maintain a good first impression
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Splash Screens Don't Show
|
||||
|
||||
**Problem**: Game starts immediately without splash screens
|
||||
|
||||
**Solutions**:
|
||||
- Check you're not using `--no-logo` flag
|
||||
- Verify logos exist in `logo/` folder before building
|
||||
- Check console output for embedding errors
|
||||
- Rebuild project completely: `cmake .. && make clean && make`
|
||||
|
||||
### Logos Appear Corrupted
|
||||
|
||||
**Problem**: Logos display incorrectly or not at all
|
||||
|
||||
**Solutions**:
|
||||
- Verify PNG files are valid (open in image viewer)
|
||||
- Check file sizes aren't too large (keep under 1MB each)
|
||||
- Ensure PNGs use standard format (not progressive or exotic encoding)
|
||||
- Rebuild project to regenerate embedded data
|
||||
|
||||
### Compilation Errors
|
||||
|
||||
**Problem**: Build fails with logo-related errors
|
||||
|
||||
**Solutions**:
|
||||
- Ensure Python 3 is installed and in PATH
|
||||
- Check `scripts/embed_logo.py` has correct paths
|
||||
- Verify `logo/` folder exists with both PNG files
|
||||
- Check CMake output for specific error messages
|
||||
|
||||
## Command Reference
|
||||
|
||||
```bash
|
||||
# Development (skip splash)
|
||||
ReiLua --no-logo
|
||||
|
||||
# Development with logging
|
||||
ReiLua --log --no-logo
|
||||
|
||||
# Production/testing (full splash)
|
||||
ReiLua
|
||||
|
||||
# Help
|
||||
ReiLua --help
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The splash screen system adds a polished touch to your ReiLua games with minimal effort. Customize it to match your studio's branding and give players a great first impression!
|
||||
@@ -1,186 +0,0 @@
|
||||
# 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 `.lua` files in `build/` 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: Custom text 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-logo` flag to skip in development
|
||||
- Logo files always embedded for consistency
|
||||
|
||||
### 4. **Asset Loading Progress API**
|
||||
- `RL.BeginAssetLoading(totalAssets)` - Initialize loading tracking
|
||||
- `RL.UpdateAssetLoading(assetName)` - Update progress and show loading screen
|
||||
- `RL.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)**
|
||||
- `--log` flag 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:**
|
||||
- `scripts/embed_lua.py` - Embeds Lua files into C header
|
||||
- `scripts/embed_assets.py` - Embeds asset files into C header
|
||||
- `scripts/embed_logo.py` - Embeds splash screen logos
|
||||
- `scripts/embed_font.py` - Embeds custom font
|
||||
|
||||
- **Source Files:**
|
||||
- `src/splash.c` - Splash screen implementation
|
||||
- `include/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 assets
|
||||
- `ASSET_LOADING.md` - Asset loading API documentation
|
||||
- `SPLASH_SCREENS.md` - Splash screen customization guide
|
||||
- `BUILD_SCRIPTS.md` - Build scripts documentation
|
||||
|
||||
- **Build Scripts:**
|
||||
- `scripts\build_dev.bat` / `scripts/build_dev.sh` - One-command development builds
|
||||
- `scripts\build_release.bat` / `scripts/build_release.sh` - One-command release builds with embedding
|
||||
|
||||
- **Icon and Resources:**
|
||||
- `icon.ico` - Default Windows executable icon
|
||||
- `resources.rc` - Windows resource file for exe metadata
|
||||
|
||||
### Modified Files
|
||||
- `CMakeLists.txt` - Added embedding options and build commands
|
||||
- `src/main.c` - Added splash screens, console control, --no-logo flag
|
||||
- `src/lua_core.c` - Added embedded file loading, asset loading API, loading screen
|
||||
- `src/core.c` - Added asset loading API functions
|
||||
- `include/core.h` - Added asset loading function declarations
|
||||
- `include/lua_core.h` - Changed luaCallMain() return type to bool
|
||||
|
||||
## Build Options
|
||||
|
||||
### Quick Build (Recommended)
|
||||
|
||||
Development (Fast Iteration):
|
||||
```bash
|
||||
# Windows
|
||||
scripts\build_dev.bat
|
||||
|
||||
# Linux/Unix
|
||||
scripts/build_dev.sh
|
||||
```
|
||||
|
||||
Release (Single Executable):
|
||||
```bash
|
||||
# Copy files to build directory first
|
||||
cd build
|
||||
copy ..\*.lua .
|
||||
mkdir assets
|
||||
copy ..\assets\* assets\
|
||||
|
||||
# Then build
|
||||
cd ..
|
||||
|
||||
# Windows
|
||||
scripts\build_release.bat
|
||||
|
||||
# Linux/Unix
|
||||
scripts/build_release.sh
|
||||
```
|
||||
|
||||
### Manual Build
|
||||
|
||||
Development Build (Fast Iteration):
|
||||
```bash
|
||||
cmake -G "MinGW Makefiles" ..
|
||||
mingw32-make
|
||||
```
|
||||
- External Lua and asset files
|
||||
- Fast edit-and-run workflow
|
||||
- Use `--no-logo` to skip splash screens
|
||||
|
||||
Release Build (Single Executable):
|
||||
```bash
|
||||
# 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
|
||||
- Clean 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 and working
|
||||
Console control working (Windows)
|
||||
Documentation complete
|
||||
SEGV crash fixed - window initializes before splash screens
|
||||
Runs successfully with and without --no-logo flag
|
||||
|
||||
## Known Changes from Original ReiLua
|
||||
- `RL.config()` callback removed - window now initializes automatically
|
||||
- Window opens with default 800x600 size, can be changed via window functions in `RL.init()`
|
||||
- Custom font (Oleaguid) always loaded for consistent appearance
|
||||
- `stateContextInit()` merged into `stateInit()`
|
||||
|
||||
## Next Steps
|
||||
1. Test with actual embedded Lua files
|
||||
2. Test with embedded assets
|
||||
3. Verify asset loading progress display
|
||||
4. Test splash screens (run without --no-logo)
|
||||
5. Create example game that uses all features
|
||||
6. 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
|
||||
@@ -1,434 +0,0 @@
|
||||
# Zed Editor Setup for ReiLua
|
||||
|
||||
This guide explains how to set up autocomplete, type hints, and documentation for ReiLua in Zed Editor.
|
||||
|
||||
---
|
||||
|
||||
## Method 1: Using Lua Language Server (Recommended)
|
||||
|
||||
Zed uses the **Lua Language Server (LuaLS)** for Lua support. ReiLua includes `tools/ReiLua_API.lua` with LuaLS annotations.
|
||||
|
||||
### Setup Steps
|
||||
|
||||
#### 1. Install Lua Language Server in Zed
|
||||
|
||||
Zed should automatically install LuaLS when you open a Lua file. If not:
|
||||
|
||||
1. Open Zed
|
||||
2. Go to **Extensions** (Cmd/Ctrl + Shift + X)
|
||||
3. Search for "Lua"
|
||||
4. Install the Lua extension
|
||||
|
||||
#### 2. Configure Your Project
|
||||
|
||||
Create a `.luarc.json` file in your project root:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtime.version": "Lua 5.4",
|
||||
"workspace.library": [
|
||||
"${3rd}/luassert/library",
|
||||
"${3rd}/busted/library"
|
||||
],
|
||||
"completion.enable": true,
|
||||
"diagnostics.globals": [
|
||||
"RL"
|
||||
],
|
||||
"workspace.checkThirdParty": false
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. Copy tools/ReiLua_API.lua to Your Project
|
||||
|
||||
Copy `tools/ReiLua_API.lua` to your game project folder:
|
||||
|
||||
```bash
|
||||
# From ReiLua directory
|
||||
cp tools/ReiLua_API.lua /path/to/your/game/project/
|
||||
```
|
||||
|
||||
Or on Windows:
|
||||
```powershell
|
||||
Copy-Item tools/ReiLua_API.lua "C:\path\to\your\game\project\"
|
||||
```
|
||||
|
||||
#### 4. (Optional) Create Library Directory
|
||||
|
||||
For better organization, create a library directory:
|
||||
|
||||
```
|
||||
your-game/
|
||||
├── main.lua
|
||||
├── .luarc.json
|
||||
└── .lua/
|
||||
└── tools/ReiLua_API.lua
|
||||
```
|
||||
|
||||
Update `.luarc.json`:
|
||||
```json
|
||||
{
|
||||
"runtime.version": "Lua 5.4",
|
||||
"workspace.library": [".lua"],
|
||||
"completion.enable": true,
|
||||
"diagnostics.globals": ["RL"],
|
||||
"workspace.checkThirdParty": false
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Method 2: Global Configuration (All Projects)
|
||||
|
||||
To make ReiLua API available for all projects:
|
||||
|
||||
### Windows
|
||||
|
||||
1. Create directory: `%USERPROFILE%\.luarocks\lib\lua\5.4\`
|
||||
2. Copy `tools/ReiLua_API.lua` to this directory
|
||||
3. Add to global LuaLS config:
|
||||
|
||||
**Location:** `%APPDATA%\Zed\settings.json` or via Zed settings
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.workspace.library": [
|
||||
"C:\\Users\\YourName\\.luarocks\\lib\\lua\\5.4"
|
||||
],
|
||||
"Lua.diagnostics.globals": ["RL"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Linux/macOS
|
||||
|
||||
1. Create directory: `~/.lua/reilua/`
|
||||
2. Copy `tools/ReiLua_API.lua` to this directory
|
||||
3. Update Zed settings:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.workspace.library": [
|
||||
"~/.lua/reilua"
|
||||
],
|
||||
"Lua.diagnostics.globals": ["RL"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Method 3: Using Zed's LSP Configuration
|
||||
|
||||
Create a `.zed/settings.json` in your project:
|
||||
> Note There is a sample zed settings json file in the repo root (zed.sample.settings.json)
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.runtime.version": "Lua 5.4",
|
||||
"Lua.workspace.library": [
|
||||
"."
|
||||
],
|
||||
"Lua.completion.enable": true,
|
||||
"Lua.completion.callSnippet": "Replace",
|
||||
"Lua.completion.displayContext": 3,
|
||||
"Lua.diagnostics.globals": [
|
||||
"RL"
|
||||
],
|
||||
"Lua.hint.enable": true,
|
||||
"Lua.hint.paramName": "All",
|
||||
"Lua.hint.setType": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verifying Setup
|
||||
|
||||
Create a test file `test.lua`:
|
||||
|
||||
```lua
|
||||
function RL.init()
|
||||
-- Type "RL." and you should see autocomplete
|
||||
RL.SetWindowTitle("Test") -- Should show documentation
|
||||
|
||||
local color = RL.RED -- Should autocomplete color constants
|
||||
|
||||
-- Hover over functions to see documentation
|
||||
RL.DrawText("Hello", 10, 10, 20, color)
|
||||
end
|
||||
|
||||
function RL.update(delta)
|
||||
-- 'delta' should show as number type
|
||||
end
|
||||
```
|
||||
|
||||
If autocomplete works, you should see:
|
||||
- Function suggestions when typing `RL.`
|
||||
- Parameter hints when calling functions
|
||||
- Documentation on hover
|
||||
- Constant values (RL.RED, RL.KEY_SPACE, etc.)
|
||||
|
||||
---
|
||||
|
||||
## Enhanced Features
|
||||
|
||||
### Enable Inlay Hints
|
||||
|
||||
In Zed settings:
|
||||
|
||||
```json
|
||||
{
|
||||
"inlay_hints": {
|
||||
"enabled": true
|
||||
},
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.hint.enable": true,
|
||||
"Lua.hint.paramName": "All",
|
||||
"Lua.hint.setType": true,
|
||||
"Lua.hint.paramType": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This will show:
|
||||
- Parameter names inline
|
||||
- Variable types
|
||||
- Return types
|
||||
|
||||
### Disable Annoying Warnings
|
||||
|
||||
Add these to suppress common false positives:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.diagnostics.disable": [
|
||||
"lowercase-global",
|
||||
"unused-local",
|
||||
"duplicate-set-field",
|
||||
"missing-fields",
|
||||
"undefined-field"
|
||||
],
|
||||
"Lua.diagnostics.globals": ["RL"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Common warnings and what they mean:
|
||||
- `lowercase-global` - Using global variables with lowercase names (RL is intentional)
|
||||
- `unused-local` - Local variables that aren't used
|
||||
- `duplicate-set-field` - Redefining functions (callback functions are expected to be redefined)
|
||||
- `missing-fields` - Table fields that might not exist
|
||||
- `undefined-field` - Accessing fields that aren't documented
|
||||
|
||||
> **Note:** The `tools/ReiLua_API.lua` file now uses type annotations instead of function definitions for callbacks to prevent duplicate warnings.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "duplicate-set-field" Error
|
||||
|
||||
**Problem:** Getting warnings like `Duplicate field 'init'. (Lua Diagnostics. duplicate-set-field)`
|
||||
|
||||
**Why:** The `tools/ReiLua_API.lua` file previously defined callback functions as empty function definitions. When you define them in your `main.lua`, LSP sees it as redefining the same field.
|
||||
|
||||
**Solution:** The latest `tools/ReiLua_API.lua` now uses type annotations instead:
|
||||
|
||||
```lua
|
||||
-- Old way (caused warnings)
|
||||
function RL.init() end
|
||||
|
||||
-- New way (no warnings)
|
||||
---@type fun()
|
||||
RL.init = nil
|
||||
```
|
||||
|
||||
Fix Steps:
|
||||
1. **Update `tools/ReiLua_API.lua`** - Copy the latest version from the repository
|
||||
2. **Or add to diagnostics.disable** in your configuration:
|
||||
```json
|
||||
{
|
||||
"diagnostics.disable": ["duplicate-set-field"]
|
||||
}
|
||||
```
|
||||
3. **Restart Zed** to reload the configuration
|
||||
|
||||
Benefits of the new approach:
|
||||
- No duplicate warnings
|
||||
- Still get autocomplete
|
||||
- Still get documentation on hover
|
||||
- Still get type checking
|
||||
|
||||
---
|
||||
|
||||
### Autocomplete Not Working
|
||||
|
||||
1. **Restart Zed** after configuration changes
|
||||
2. **Check LSP Status**: Look for Lua Language Server in bottom-right status bar
|
||||
3. **Verify File Location**: Ensure `tools/ReiLua_API.lua` is in the workspace
|
||||
4. **Check Console**: Open Zed's log to see LSP errors
|
||||
|
||||
### Performance Issues
|
||||
|
||||
If the language server is slow:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.workspace.maxPreload": 2000,
|
||||
"Lua.workspace.preloadFileSize": 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Missing Documentation
|
||||
|
||||
Ensure hover is enabled:
|
||||
|
||||
```json
|
||||
{
|
||||
"hover_popover_enabled": true
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Advanced: Custom Annotations
|
||||
|
||||
You can extend `tools/ReiLua_API.lua` with your own game types:
|
||||
|
||||
```lua
|
||||
---@class Player
|
||||
---@field x number
|
||||
---@field y number
|
||||
---@field health number
|
||||
|
||||
---@class Enemy
|
||||
---@field x number
|
||||
---@field y number
|
||||
---@field damage number
|
||||
|
||||
-- Your game globals
|
||||
---@type Player
|
||||
player = {}
|
||||
|
||||
---@type Enemy[]
|
||||
enemies = {}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Keyboard Shortcuts in Zed
|
||||
|
||||
- **Trigger Autocomplete**: `Ctrl+Space` (Windows/Linux) or `Cmd+Space` (macOS)
|
||||
- **Show Documentation**: Hover or `Ctrl+K Ctrl+I`
|
||||
- **Go to Definition**: `F12` or `Cmd+Click`
|
||||
- **Find References**: `Shift+F12`
|
||||
- **Rename Symbol**: `F2`
|
||||
|
||||
---
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Lua Language Server GitHub](https://github.com/LuaLS/lua-language-server)
|
||||
- [LuaLS Annotations Guide](https://github.com/LuaLS/lua-language-server/wiki/Annotations)
|
||||
- [Zed Documentation](https://zed.dev/docs)
|
||||
|
||||
---
|
||||
|
||||
## Example Project Structure
|
||||
|
||||
```
|
||||
my-reilua-game/
|
||||
├── .luarc.json # LuaLS configuration
|
||||
├── .zed/
|
||||
│ └── settings.json # Zed-specific settings
|
||||
├── tools/ReiLua_API.lua # API definitions (copy from ReiLua)
|
||||
├── main.lua # Your game entry point
|
||||
├── player.lua
|
||||
├── enemy.lua
|
||||
└── assets/
|
||||
├── sprites/
|
||||
└── sounds/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Quick Start Template
|
||||
|
||||
Save this as `.luarc.json` in your project:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtime.version": "Lua 5.4",
|
||||
"completion.enable": true,
|
||||
"completion.callSnippet": "Replace",
|
||||
"diagnostics.globals": ["RL"],
|
||||
"diagnostics.disable": [
|
||||
"lowercase-global",
|
||||
"duplicate-set-field",
|
||||
"missing-fields"
|
||||
],
|
||||
"workspace.checkThirdParty": false,
|
||||
"workspace.library": ["."],
|
||||
"hint.enable": true
|
||||
}
|
||||
```
|
||||
|
||||
Save this as `.zed/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"lua-language-server": {
|
||||
"settings": {
|
||||
"Lua.hint.enable": true,
|
||||
"Lua.hint.paramName": "All",
|
||||
"Lua.hint.setType": true,
|
||||
"Lua.diagnostics.disable": [
|
||||
"lowercase-global",
|
||||
"duplicate-set-field",
|
||||
"missing-fields"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"inlay_hints": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then copy `tools/ReiLua_API.lua` to your project root, and you're ready to go!
|
||||
|
||||
---
|
||||
|
||||
Happy Coding!
|
||||
174
docs/generate.py
Normal file
174
docs/generate.py
Normal file
@@ -0,0 +1,174 @@
|
||||
#!/usr/bin/env python3
|
||||
"""ReiLua Documentation Generator"""
|
||||
import os, re
|
||||
from pathlib import Path
|
||||
|
||||
HTML_TEMPLATE = '''<!DOCTYPE HTML><html><head><title>{title}</title>
|
||||
<link rel="stylesheet" href="style.css"><meta charset="utf-8"></head><body>
|
||||
<div class="container"><div class="navigation">
|
||||
<a href="index.html">home</a> · <a href="manual.html">manual</a> · <a href="reference.html">reference</a>
|
||||
</div>{content}<div class="footer"><p>ReiLua Enhanced · <a href="https://indrajith.dev">indrajith.dev</a></p></div></div></body></html>'''
|
||||
|
||||
def fix_links(t):
|
||||
t=re.sub(r'\(([^)]+)\.md\)',r'(manual.html)',t)
|
||||
t=re.sub(r'\(docs/[^)]+\.md\)',r'(manual.html)',t)
|
||||
t=re.sub(r'\(\.\.\/docs\/[^)]+\.md\)',r'(manual.html)',t)
|
||||
return t
|
||||
|
||||
def md2html(md):
|
||||
h=fix_links(md)
|
||||
|
||||
# Protect code blocks by replacing them with placeholders
|
||||
code_blocks = []
|
||||
def save_code(m):
|
||||
code_blocks.append(m.group(0))
|
||||
return f'___CODE_BLOCK_{len(code_blocks)-1}___'
|
||||
h=re.sub(r'```[^\n]*\n.*?```',save_code,h,flags=re.DOTALL)
|
||||
|
||||
# Now process markdown (code is protected)
|
||||
# Headers - MUST be before bold/italic to avoid conflicts
|
||||
h=re.sub(r'^#### (.+)$',r'<h4>\1</h4>',h,flags=re.MULTILINE)
|
||||
h=re.sub(r'^### (.+)$',r'<h3>\1</h3>',h,flags=re.MULTILINE)
|
||||
h=re.sub(r'^## (.+)$',r'<h2>\1</h2>',h,flags=re.MULTILINE)
|
||||
h=re.sub(r'^# (.+)$',r'<h1>\1</h1>',h,flags=re.MULTILINE)
|
||||
|
||||
# Links
|
||||
h=re.sub(r'\[([^\]]+)\]\(([^\)]+)\)',r'<a href="\2">\1</a>',h)
|
||||
|
||||
# Bold/italic (after headers to avoid **text:** becoming headings)
|
||||
h=re.sub(r'\*\*([^\*]+)\*\*',r'<strong>\1</strong>',h)
|
||||
h=re.sub(r'\*([^\*\n]+)\*',r'<em>\1</em>',h)
|
||||
|
||||
# Inline code
|
||||
h=re.sub(r'`([^`]+)`',r'<code>\1</code>',h)
|
||||
|
||||
# Restore code blocks
|
||||
for i, block in enumerate(code_blocks):
|
||||
content = re.search(r'```[^\n]*\n(.*?)```', block, re.DOTALL).group(1)
|
||||
h = h.replace(f'___CODE_BLOCK_{i}___', f'<pre><code>{content}</code></pre>')
|
||||
|
||||
# Process line by line for paragraphs and lists
|
||||
lines=h.split('\n')
|
||||
result=[]
|
||||
in_ul=False
|
||||
in_pre=False
|
||||
para_buffer=[]
|
||||
|
||||
def flush_para():
|
||||
if para_buffer:
|
||||
result.append('<p>' + ' '.join(para_buffer) + '</p>')
|
||||
para_buffer.clear()
|
||||
|
||||
for line in lines:
|
||||
s=line.strip()
|
||||
|
||||
# Track pre blocks
|
||||
if '<pre>' in line:
|
||||
flush_para()
|
||||
in_pre=True
|
||||
result.append(line)
|
||||
continue
|
||||
if '</pre>' in line:
|
||||
in_pre=False
|
||||
result.append(line)
|
||||
continue
|
||||
if in_pre:
|
||||
result.append(line)
|
||||
continue
|
||||
|
||||
# Handle list items
|
||||
if s.startswith(('- ','* ')):
|
||||
flush_para()
|
||||
if not in_ul:
|
||||
result.append('<ul>')
|
||||
in_ul=True
|
||||
item=re.sub(r'^[\-\*]\s+','',s)
|
||||
result.append(f'<li>{item}</li>')
|
||||
continue
|
||||
|
||||
# End list if needed
|
||||
if in_ul and not s.startswith(('- ','* ')):
|
||||
result.append('</ul>')
|
||||
in_ul=False
|
||||
|
||||
# Handle block elements
|
||||
if s.startswith('<h') or s.startswith('<div') or s.startswith('<hr'):
|
||||
flush_para()
|
||||
result.append(line)
|
||||
continue
|
||||
|
||||
# Empty line = paragraph break
|
||||
if not s:
|
||||
flush_para()
|
||||
continue
|
||||
|
||||
# Accumulate paragraph text
|
||||
if s and not s.startswith('<'):
|
||||
para_buffer.append(s)
|
||||
else:
|
||||
flush_para()
|
||||
result.append(line)
|
||||
|
||||
# Flush remaining
|
||||
flush_para()
|
||||
if in_ul:
|
||||
result.append('</ul>')
|
||||
|
||||
return '\n'.join(result)
|
||||
|
||||
def parse_api(f):
|
||||
with open(f,'r',encoding='utf-8') as fp: c=fp.read()
|
||||
secs=[]; cur=None; lines=c.split('\n'); i=0
|
||||
while i<len(lines):
|
||||
l=lines[i]; s=l.strip()
|
||||
if s.startswith('## ') and not s.startswith('###'):
|
||||
if cur and cur.get('items'): secs.append(cur)
|
||||
cur={'title':s.replace('##','').strip(),'items':[]}; i+=1; continue
|
||||
if s.startswith('>'):
|
||||
if not cur: cur={'title':'Definitions','items':[]}
|
||||
d=s.replace('>','').strip(); desc=[]; i+=1
|
||||
while i<len(lines):
|
||||
n=lines[i]; ns=n.strip()
|
||||
if ns.startswith('>') or (ns.startswith('##') and not ns.startswith('###')): break
|
||||
if ns=='---': i+=1; break
|
||||
desc.append(n); i+=1
|
||||
cur['items'].append({'definition':d,'description':'\n'.join(desc).strip()}); continue
|
||||
i+=1
|
||||
if cur and cur.get('items'): secs.append(cur)
|
||||
return secs
|
||||
|
||||
out=Path(__file__).parent
|
||||
(out/'index.html').write_text(HTML_TEMPLATE.format(title='ReiLua',content='<h1>ReiLua Enhanced</h1><p>Lua binding for Raylib.</p><h2>Documentation</h2><ul><li><a href="manual.html">Manual</a></li><li><a href="reference.html">API Reference</a></li></ul><h2>Quick Start</h2><p>Create <code>main.lua</code>:</p><pre><code>function RL.init()\n RL.SetWindowTitle("Hello")\nend\n\nfunction RL.update(dt)\nend\n\nfunction RL.draw()\n RL.ClearBackground(RL.RAYWHITE)\n RL.DrawText("Hello!",190,200,20,RL.BLACK)\nend</code></pre><p>Run: <code>ReiLua.exe</code></p>'),encoding='utf-8')
|
||||
print('✓ index.html')
|
||||
|
||||
parts=['<h1>ReiLua Manual</h1>']
|
||||
readme=Path('../README.md')
|
||||
if readme.exists():
|
||||
parts.append(md2html(re.sub(r'!\[.*?\]\(.*?\)','',readme.read_text(encoding='utf-8'))))
|
||||
parts.append('<hr>')
|
||||
for fp,t in [('../docs/EMBEDDING.md','Embedding'),('../docs/ASSET_LOADING.md','Asset Loading'),('../docs/SPLASH_SCREENS.md','Splash Screens'),('../docs/BUILD_SCRIPTS.md','Build Scripts'),('../docs/CUSTOMIZATION.md','Customization'),('../docs/ZED_EDITOR_SETUP.md','Editor Setup')]:
|
||||
p=Path(fp)
|
||||
if p.exists():
|
||||
a=t.lower().replace(' ','-')
|
||||
parts.append(f'<h2 id="{a}">{t}</h2>')
|
||||
parts.append(md2html(p.read_text(encoding='utf-8')))
|
||||
parts.append('<hr>')
|
||||
(out/'manual.html').write_text(HTML_TEMPLATE.format(title='Manual',content='\n'.join(parts)),encoding='utf-8')
|
||||
print('✓ manual.html')
|
||||
|
||||
secs=parse_api(Path('../docs/API.md'))
|
||||
parts=['<h1>ReiLua API Reference</h1><p>Complete function reference.</p><h2>Contents</h2><ul>']
|
||||
for s in secs:
|
||||
a=s['title'].lower().replace(' ','-').replace('/','').replace('.','')
|
||||
parts.append(f'<li><a href="#{a}">{s["title"]}</a> ({len(s["items"])} items)</li>')
|
||||
parts.append('</ul>')
|
||||
for s in secs:
|
||||
a=s['title'].lower().replace(' ','-').replace('/','').replace('.','')
|
||||
parts.append(f'<h2 id="{a}">{s["title"]}</h2>')
|
||||
for i in s['items']:
|
||||
parts.append(f'<div class="apii"><code>{i["definition"]}</code></div>')
|
||||
if i['description']:
|
||||
parts.append(f'<div class="apidesc">{md2html(i["description"])}</div>')
|
||||
(out/'reference.html').write_text(HTML_TEMPLATE.format(title='API Reference',content='\n'.join(parts)),encoding='utf-8')
|
||||
print(f'✓ reference.html ({sum(len(s["items"]) for s in secs)} items)')
|
||||
print('Complete!')
|
||||
15
docs/index.html
Normal file
15
docs/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML><html><head><title>ReiLua</title>
|
||||
<link rel="stylesheet" href="style.css"><meta charset="utf-8"></head><body>
|
||||
<div class="container"><div class="navigation">
|
||||
<a href="index.html">home</a> · <a href="manual.html">manual</a> · <a href="reference.html">reference</a>
|
||||
</div><h1>ReiLua Enhanced</h1><p>Lua binding for Raylib.</p><h2>Documentation</h2><ul><li><a href="manual.html">Manual</a></li><li><a href="reference.html">API Reference</a></li></ul><h2>Quick Start</h2><p>Create <code>main.lua</code>:</p><pre><code>function RL.init()
|
||||
RL.SetWindowTitle("Hello")
|
||||
end
|
||||
|
||||
function RL.update(dt)
|
||||
end
|
||||
|
||||
function RL.draw()
|
||||
RL.ClearBackground(RL.RAYWHITE)
|
||||
RL.DrawText("Hello!",190,200,20,RL.BLACK)
|
||||
end</code></pre><p>Run: <code>ReiLua.exe</code></p><div class="footer"><p>ReiLua Enhanced · <a href="https://indrajith.dev">indrajith.dev</a></p></div></div></body></html>
|
||||
2144
docs/manual.html
Normal file
2144
docs/manual.html
Normal file
File diff suppressed because it is too large
Load Diff
6023
docs/reference.html
Normal file
6023
docs/reference.html
Normal file
File diff suppressed because it is too large
Load Diff
136
docs/style.css
Normal file
136
docs/style.css
Normal file
@@ -0,0 +1,136 @@
|
||||
/* ReiLua Documentation - Lua Manual Style */
|
||||
|
||||
body {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #000000;
|
||||
background-color: #FFFFFF;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
font-weight: normal;
|
||||
margin: 20px 0 10px 0;
|
||||
color: #000080;
|
||||
border-bottom: 1px solid #000080;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
margin: 20px 0 10px 0;
|
||||
color: #000080;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 15px 0 10px 0;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
font-size: 12px;
|
||||
margin: 10px 0;
|
||||
padding: 10px;
|
||||
background-color: #F0F0F0;
|
||||
border: 1px solid #D0D0D0;
|
||||
}
|
||||
|
||||
.navigation a {
|
||||
color: #000080;
|
||||
text-decoration: none;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
.navigation a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000080;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
code, tt {
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
font-size: 13px;
|
||||
background-color: #F5F5F5;
|
||||
padding: 1px 4px;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
font-size: 13px;
|
||||
background-color: #F5F5F5;
|
||||
border: 1px solid #D0D0D0;
|
||||
padding: 10px;
|
||||
overflow-x: auto;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.apii {
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
margin: 15px 0 5px 0;
|
||||
padding: 8px;
|
||||
background-color: #F0F0F0;
|
||||
border-left: 3px solid #000080;
|
||||
}
|
||||
|
||||
.apii code {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.apidesc {
|
||||
margin: 5px 0 15px 20px;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
margin: 10px 0;
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #F0F0F0;
|
||||
border: 1px solid #D0D0D0;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid #D0D0D0;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 40px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #D0D0D0;
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
Reference in New Issue
Block a user