docs: Add HTML documentation generator and improve documentation structure
- Add html_docs/ directory with Python-based documentation generator - Include custom CSS styling for modern, clean documentation layout - Update README.md with improved formatting and documentation links - Enhance markdown documentation across all docs/ files: - Improve API documentation with better code examples - Refactor DOCUMENTATION_INDEX.md for clearer navigation - Update EMBEDDING.md, CUSTOMIZATION.md, and other guides - Standardize formatting and improve readability throughout - Fix inconsistent line endings and formatting issues The HTML documentation generator creates a styled, browsable version of the project documentation for easier reading and navigation.
This commit is contained in:
58
README.md
58
README.md
@@ -7,18 +7,18 @@
|
||||
## About This Version
|
||||
|
||||
This is an enhanced version of ReiLua featuring:
|
||||
- 🎮 **Embedded Lua Support** - Bundle all your Lua code into a single executable
|
||||
- 📦 **Embedded Assets** - Package images, sounds, and other assets into your game
|
||||
- 🎨 **Splash Screens** - Customizable startup screens featuring Raylib and ReiLua
|
||||
- 📊 **Asset Loading System** - Beautiful loading screen with progress tracking
|
||||
- 🔧 **Automated Build Scripts** - One-command development and release builds
|
||||
- 🪟 **Console Control** - Debug logging system for development
|
||||
- **Embedded Lua Support** - Bundle all your Lua code into a single executable
|
||||
- **Embedded Assets** - Package images, sounds, and other assets into your game
|
||||
- **Splash Screens** - Customizable startup screens featuring Raylib and ReiLua
|
||||
- **Asset Loading System** - Loading screen with progress tracking
|
||||
- **Automated Build Scripts** - One-command development and release builds
|
||||
- **Console Control** - Debug logging system for development
|
||||
|
||||
## What is ReiLua?
|
||||
|
||||
ReiLua brings the power and simplicity of Raylib to the beginner-friendly Lua language in a straightforward manner. It is a loose binding to Raylib - some functions are excluded and some are added. The concept of pointing to a "main.lua" file and accessing functions "init", "update", and "draw" is borrowed from the Löve game framework.
|
||||
|
||||
**Note:** ReiLua is lovingly :heart: handcrafted and will likely contain bugs and documentation errors, so it would be much appreciated if you would report any such findings.
|
||||
**Note:** ReiLua is lovingly handcrafted and will likely contain bugs and documentation errors, so it would be much appreciated if you would report any such findings.
|
||||
|
||||
**Reilua** means "fair" in Finnish.
|
||||
|
||||
@@ -81,7 +81,8 @@ List of some MISSING features that are planned to be included:
|
||||
|
||||
### For Game Developers
|
||||
|
||||
**Development Mode (Fast Iteration):**
|
||||
Development Mode (Fast Iteration):
|
||||
|
||||
```bash
|
||||
# 1. Create your game files
|
||||
GameFolder/
|
||||
@@ -104,7 +105,8 @@ ReiLua.exe --no-logo
|
||||
ReiLua.exe --log --no-logo
|
||||
```
|
||||
|
||||
**Release Mode (Single Executable):**
|
||||
Release Mode (Single Executable):
|
||||
|
||||
```bash
|
||||
# See "Building for Release" section below
|
||||
```
|
||||
@@ -175,12 +177,12 @@ This version includes customizable splash screens that display at startup:
|
||||
|
||||
Each screen fades in (0.8s), displays (2.5s), and fades out (0.8s) for a total of ~8 seconds.
|
||||
|
||||
**Skip During Development:**
|
||||
Skip During Development:
|
||||
```bash
|
||||
ReiLua.exe --no-logo
|
||||
```
|
||||
|
||||
**Customize:**
|
||||
Customize:
|
||||
- Change text in `src/splash.c`
|
||||
- Replace logos in `logo/` folder
|
||||
- Adjust timing with constants in `src/splash.c`
|
||||
@@ -221,7 +223,7 @@ function RL.init()
|
||||
end
|
||||
```
|
||||
|
||||
**Features:**
|
||||
Features:
|
||||
- Retro 1-bit pixel art aesthetic
|
||||
- Animated loading text with dots
|
||||
- Progress bar with dithering pattern
|
||||
@@ -294,7 +296,7 @@ This shows:
|
||||
|
||||
One-command builds for development and release:
|
||||
|
||||
**Development Build (Fast Iteration):**
|
||||
Development Build (Fast Iteration):
|
||||
```bash
|
||||
# Windows
|
||||
scripts\build_dev.bat
|
||||
@@ -307,7 +309,7 @@ scripts/build_dev.sh
|
||||
- Fast build times
|
||||
- Edit code without rebuilding
|
||||
|
||||
**Release Build (Distribution):**
|
||||
Release Build (Distribution):
|
||||
```bash
|
||||
# Prepare files first
|
||||
cd build
|
||||
@@ -453,13 +455,13 @@ copy liblua.a path\to\ReiLua\lib\
|
||||
|
||||
#### 4. Build ReiLua
|
||||
|
||||
**Quick Method (Recommended):**
|
||||
Quick Method (Recommended):
|
||||
```bash
|
||||
cd ReiLua
|
||||
scripts\build_dev.bat
|
||||
```
|
||||
|
||||
**Manual Method:**
|
||||
Manual Method:
|
||||
```bash
|
||||
cd ReiLua\build
|
||||
cmake -G "MinGW Makefiles" ..
|
||||
@@ -491,14 +493,14 @@ Move both `.a` files to the `ReiLua/lib` folder.
|
||||
|
||||
#### 3. Build ReiLua
|
||||
|
||||
**Quick Method (Recommended):**
|
||||
Quick Method (Recommended):
|
||||
```bash
|
||||
cd ReiLua
|
||||
chmod +x scripts/build_dev.sh
|
||||
scripts/build_dev.sh
|
||||
```
|
||||
|
||||
**Manual Method:**
|
||||
Manual Method:
|
||||
```bash
|
||||
cd ReiLua/build
|
||||
cmake ..
|
||||
@@ -651,9 +653,9 @@ ReiLua.exe --log
|
||||
```
|
||||
|
||||
Verify:
|
||||
- ✅ No file loading errors
|
||||
- ✅ Game runs correctly
|
||||
- ✅ All assets load properly
|
||||
- No file loading errors
|
||||
- Game runs correctly
|
||||
- All assets load properly
|
||||
|
||||
### Step 5: Distribute
|
||||
|
||||
@@ -840,32 +842,32 @@ path\to\ReiLua.exe --log --no-logo
|
||||
|
||||
### Common Issues
|
||||
|
||||
**Game doesn't start:**
|
||||
Game doesn't start:
|
||||
- Run with `--log` to see error messages
|
||||
- Check that `main.lua` exists
|
||||
- Verify all required assets exist
|
||||
|
||||
**Assets not loading:**
|
||||
Assets not loading:
|
||||
- Check file paths (use forward slashes or escaped backslashes)
|
||||
- Verify files exist in the correct location
|
||||
- Use `--log` to see loading errors
|
||||
|
||||
**Splash screens don't show:**
|
||||
Splash screens don't show:
|
||||
- Check you're not using `--no-logo` flag
|
||||
- Verify build completed successfully
|
||||
- Rebuild project: `cmake --build . --config Release`
|
||||
|
||||
**Lua files not embedded:**
|
||||
Lua files not embedded:
|
||||
- Ensure Lua files are in `build/` directory before building
|
||||
- Check `main.lua` exists
|
||||
- Verify `-DEMBED_MAIN=ON` was used
|
||||
|
||||
**Assets not embedded:**
|
||||
Assets not embedded:
|
||||
- Create `build/assets/` folder
|
||||
- Copy assets before building
|
||||
- Verify `-DEMBED_ASSETS=ON` was used
|
||||
|
||||
**Build fails:**
|
||||
Build fails:
|
||||
- Check CMake and compiler are installed and in PATH
|
||||
- Verify `libraylib.a` and `liblua.a` are in `lib/` folder
|
||||
- Try clean build: `scripts\build_dev.bat clean`
|
||||
@@ -910,4 +912,4 @@ ReiLua is licensed under the zlib/libpng license. See LICENSE file for details.
|
||||
|
||||
---
|
||||
|
||||
**Happy Game Development! 🎮**
|
||||
Happy Game Development!
|
||||
|
||||
90
docs/API.md
90
docs/API.md
@@ -59,6 +59,96 @@ This function will be called when unloading resource that has allocated memory.
|
||||
|
||||
---
|
||||
|
||||
## ReiLua Enhanced Functions
|
||||
|
||||
These functions are part of ReiLua Enhanced Edition and provide additional functionality for asset loading and game development.
|
||||
|
||||
---
|
||||
|
||||
> RL.BeginAssetLoading( int totalAssets )
|
||||
|
||||
Initialize asset loading progress tracking and show the loading screen. This displays a beautiful loading UI with progress bar and asset names.
|
||||
|
||||
Parameters:
|
||||
- `totalAssets` (integer) - Total number of assets to load
|
||||
|
||||
Example:
|
||||
```lua
|
||||
RL.BeginAssetLoading(10) -- We're loading 10 assets
|
||||
```
|
||||
|
||||
Features:
|
||||
- Shows animated "LOADING..." text with dots
|
||||
- Displays progress bar with shimmer effect
|
||||
- Shows current asset name being loaded
|
||||
- Shows progress counter (e.g., "3 / 10")
|
||||
- 1-bit pixel art aesthetic
|
||||
|
||||
---
|
||||
|
||||
> RL.UpdateAssetLoading( string assetName )
|
||||
|
||||
Update loading progress for the current asset. Call this after each asset is loaded to update the progress bar and display.
|
||||
|
||||
Parameters:
|
||||
- `assetName` (string) - Name of the asset currently being loaded
|
||||
|
||||
Example:
|
||||
```lua
|
||||
RL.UpdateAssetLoading("player.png")
|
||||
-- Load the asset here
|
||||
playerTexture = RL.LoadTexture("assets/player.png")
|
||||
```
|
||||
|
||||
Notes:
|
||||
- Automatically increments the loaded asset counter
|
||||
- Updates the loading screen UI
|
||||
- Shows the asset name on screen
|
||||
- Updates progress bar percentage
|
||||
|
||||
---
|
||||
|
||||
> RL.EndAssetLoading()
|
||||
|
||||
Finish asset loading and hide the loading screen. Call this after all assets have been loaded.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
Complete Example:
|
||||
```lua
|
||||
function RL.init()
|
||||
local assets = {}
|
||||
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)
|
||||
|
||||
if path:match("%.png$") then
|
||||
assets[i] = RL.LoadTexture(path)
|
||||
elseif path:match("%.wav$") then
|
||||
assets[i] = RL.LoadSound(path)
|
||||
end
|
||||
end
|
||||
|
||||
-- Done loading
|
||||
RL.EndAssetLoading()
|
||||
end
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Object unloading
|
||||
|
||||
Some objects allocate memory that needs to be freed when object is no longer needed. By default objects like Textures are unloaded by the Lua garbage collector. It is generatty however recommended to handle this manually in more complex projects. You can change the behavior with SetGCUnload.
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
# Asset Loading System
|
||||
|
||||
ReiLua includes a built-in asset loading system with a nice loading screen UI that automatically shows progress while assets are being loaded.
|
||||
ReiLua includes a built-in asset loading system with a loading screen UI that shows progress while assets are being loaded.
|
||||
|
||||
## 🎨 Features
|
||||
## Features
|
||||
|
||||
- **Automatic Progress Tracking** - Tracks how many assets have been loaded
|
||||
- **Beautiful Loading UI** - Modern, minimal loading screen with:
|
||||
- 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
|
||||
- Dark, clean color scheme
|
||||
- **Easy to Use** - Just 3 functions to show loading progress
|
||||
- **Works Everywhere** - Development and release builds
|
||||
- Easy to Use - Just 3 functions to show loading progress
|
||||
- Works in development and release builds
|
||||
|
||||
## 📝 API Functions
|
||||
## API Functions
|
||||
|
||||
### RL.BeginAssetLoading(totalAssets)
|
||||
|
||||
Initialize asset loading progress tracking and show the loading screen.
|
||||
|
||||
**Parameters:**
|
||||
Parameters:
|
||||
- `totalAssets` (integer) - Total number of assets to load
|
||||
|
||||
**Example:**
|
||||
Example:
|
||||
```lua
|
||||
RL.BeginAssetLoading(10) -- We're loading 10 assets
|
||||
```
|
||||
@@ -34,10 +33,10 @@ RL.BeginAssetLoading(10) -- We're loading 10 assets
|
||||
|
||||
Update the loading progress and display current asset being loaded.
|
||||
|
||||
**Parameters:**
|
||||
Parameters:
|
||||
- `assetName` (string) - Name of the asset currently being loaded
|
||||
|
||||
**Example:**
|
||||
Example:
|
||||
```lua
|
||||
RL.UpdateAssetLoading("player.png")
|
||||
```
|
||||
@@ -50,12 +49,12 @@ Call this **after** each asset is loaded to update the progress bar.
|
||||
|
||||
Finish asset loading and hide the loading screen.
|
||||
|
||||
**Example:**
|
||||
Example:
|
||||
```lua
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
## 🚀 Quick Example
|
||||
## Quick Example
|
||||
|
||||
```lua
|
||||
function RL.init()
|
||||
@@ -87,7 +86,7 @@ function RL.init()
|
||||
end
|
||||
```
|
||||
|
||||
## 💡 Complete Example
|
||||
## Complete Example
|
||||
|
||||
```lua
|
||||
local assets = {}
|
||||
@@ -146,16 +145,16 @@ function RL.draw()
|
||||
end
|
||||
```
|
||||
|
||||
## 🎨 Loading Screen Appearance
|
||||
## Loading Screen Appearance
|
||||
|
||||
The loading screen features a clean 1-bit pixel art style:
|
||||
|
||||
**Design:**
|
||||
Design:
|
||||
- Pure black and white aesthetic
|
||||
- Retro pixel art styling
|
||||
- Minimal and clean design
|
||||
|
||||
**Elements:**
|
||||
Elements:
|
||||
- **Title**: "LOADING" in bold white pixel text
|
||||
- **Animated Dots**: White pixelated dots (4x4 squares) that cycle
|
||||
- **Progress Bar**:
|
||||
@@ -167,52 +166,34 @@ The loading screen features a clean 1-bit pixel art style:
|
||||
- **Asset Name**: Current loading asset in small white text
|
||||
- **Corner Decorations**: White pixel art L-shaped corners in all 4 corners
|
||||
|
||||
**Background:**
|
||||
Background:
|
||||
- Pure black background (#000000)
|
||||
- High contrast for maximum clarity
|
||||
|
||||
**Color Palette:**
|
||||
Color Palette:
|
||||
- White text and UI (#FFFFFF)
|
||||
- Black background (#000000)
|
||||
- Pure 1-bit aesthetic (inverted terminal style)
|
||||
|
||||
**Visual Layout:**
|
||||
```
|
||||
[Black Background]
|
||||
|
||||
┌─┐ ┌─┐
|
||||
│ │ LOADING □ □ │ │
|
||||
│ │ │ │
|
||||
│ │ ┌──────────────────┐ │ │
|
||||
│ │ │████████░░░░░░░░░░│ 3/10 │ │
|
||||
│ │ └──────────────────┘ │ │
|
||||
│ │ │ │
|
||||
│ │ player.png │ │
|
||||
│ │ │ │
|
||||
└─┘ └─┘
|
||||
|
||||
[All text and UI elements in WHITE]
|
||||
```
|
||||
|
||||
**Style Inspiration:**
|
||||
Style Inspiration:
|
||||
- Classic terminal / console aesthetic
|
||||
- MS-DOS loading screens
|
||||
- 1-bit dithering patterns
|
||||
- Chunky pixel borders
|
||||
- Retro computing / CRT monitor style
|
||||
|
||||
## 🔧 Customization
|
||||
## 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
|
||||
## 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
|
||||
## Example Asset Loading Patterns
|
||||
|
||||
### Pattern 1: Simple List
|
||||
```lua
|
||||
@@ -260,26 +241,26 @@ end
|
||||
RL.EndAssetLoading()
|
||||
```
|
||||
|
||||
## 🎮 When to Use
|
||||
## When to Use
|
||||
|
||||
**Use the loading system when:**
|
||||
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 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
|
||||
- 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!
|
||||
|
||||
@@ -19,24 +19,24 @@ Fast iteration during game development with external Lua files and assets.
|
||||
|
||||
### Usage
|
||||
|
||||
**Windows:**
|
||||
Windows:
|
||||
```cmd
|
||||
scripts\build_dev.bat
|
||||
```
|
||||
|
||||
**Linux/Unix:**
|
||||
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`
|
||||
- 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`
|
||||
@@ -67,25 +67,25 @@ copy ..\your_game\assets\* assets\
|
||||
|
||||
### Usage
|
||||
|
||||
**Windows:**
|
||||
Windows:
|
||||
```cmd
|
||||
scripts\build_release.bat
|
||||
```
|
||||
|
||||
**Linux/Unix:**
|
||||
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
|
||||
- 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`
|
||||
|
||||
@@ -322,11 +322,11 @@ 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
|
||||
- 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
|
||||
|
||||
@@ -359,22 +359,22 @@ Before releasing your game:
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Icon doesn't change:**
|
||||
Icon doesn't change:
|
||||
- Ensure .ico file is valid
|
||||
- Rebuild completely (clean build)
|
||||
- Clear icon cache (Windows): Delete `IconCache.db`
|
||||
|
||||
**Properties don't update:**
|
||||
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:**
|
||||
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:**
|
||||
Executable name unchanged:
|
||||
- Check `CMakeLists.txt` project name
|
||||
- Do a clean rebuild
|
||||
- Verify cmake configuration step succeeded
|
||||
|
||||
@@ -4,160 +4,115 @@ This document provides a quick reference to all available documentation for ReiL
|
||||
|
||||
## Core Documentation
|
||||
|
||||
### 📘 [README.md](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
|
||||
- Troubleshooting
|
||||
**README.md** - START HERE
|
||||
|
||||
**Read this first!**
|
||||
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](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
|
||||
- Troubleshooting splash screen issues
|
||||
**SPLASH_SCREENS.md** - Everything about splash screens
|
||||
|
||||
### 📦 [EMBEDDING.md](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
|
||||
- Troubleshooting embedding issues
|
||||
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.
|
||||
|
||||
### 📊 [ASSET_LOADING.md](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
|
||||
- Customization options
|
||||
**EMBEDDING.md** - Complete guide to embedding
|
||||
|
||||
### 🔧 [BUILD_SCRIPTS.md](BUILD_SCRIPTS.md)
|
||||
Build automation documentation:
|
||||
- `scripts\build_dev.bat` / `scripts/build_dev.sh` - Development builds
|
||||
- `scripts\build_release.bat` / `scripts/build_release.sh` - Release builds
|
||||
- Features of each build type
|
||||
- Workflow examples
|
||||
- Customizing executable name, icon, and properties
|
||||
- Troubleshooting build issues
|
||||
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.
|
||||
|
||||
### 🎨 [CUSTOMIZATION.md](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
|
||||
- Removing ReiLua branding (with attribution notes)
|
||||
**ASSET_LOADING.md** - Asset loading system documentation
|
||||
|
||||
### 💻 [ZED_EDITOR_SETUP.md](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
|
||||
- Workflow tips and best practices
|
||||
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](API.md)
|
||||
Complete API reference:
|
||||
- 1000+ functions
|
||||
- All ReiLua/Raylib bindings
|
||||
- Function signatures
|
||||
- Raygui, Raymath, Lights, Easings, RLGL modules
|
||||
**API.md** - Complete API reference
|
||||
|
||||
### 📝 [tools/ReiLua_API.lua](tools/ReiLua_API.lua)
|
||||
Lua annotations file:
|
||||
- Provides autocomplete in LSP-enabled editors
|
||||
- Function documentation
|
||||
- Copy to your project for IDE support
|
||||
1000+ functions, all ReiLua/Raylib bindings, function signatures, Raygui, Raymath, Lights, Easings, and RLGL modules.
|
||||
|
||||
### 🔄 [UPGRADE_SUMMARY.md](UPGRADE_SUMMARY.md)
|
||||
Technical implementation details:
|
||||
- Features added in this enhanced version
|
||||
- Files modified and added
|
||||
- Build options explained
|
||||
- Testing checklist
|
||||
- Known changes from original ReiLua
|
||||
**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](README.md) - Quick Start section
|
||||
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](EMBEDDING.md)
|
||||
2. Use `scripts\build_release.bat` / `scripts/build_release.sh`
|
||||
3. Follow the complete release workflow in [README.md](README.md)
|
||||
I want to embed my game into a single .exe
|
||||
|
||||
### "I want to add a loading screen"
|
||||
1. Read [ASSET_LOADING.md](ASSET_LOADING.md)
|
||||
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](SPLASH_SCREENS.md)
|
||||
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](CUSTOMIZATION.md)
|
||||
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](ZED_EDITOR_SETUP.md)
|
||||
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](README.md) - Building from Source section
|
||||
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](API.md)
|
||||
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](tools/ReiLua_API.lua) for autocomplete
|
||||
4. Or copy tools/ReiLua_API.lua for autocomplete
|
||||
|
||||
---
|
||||
|
||||
@@ -190,22 +145,21 @@ When adding new features, please:
|
||||
## 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
|
||||
- ✅ Emoji icons for visual scanning
|
||||
- ✅ Complete but concise
|
||||
- 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/
|
||||
- Original ReiLua: https://github.com/Gamerfiend/ReiLua
|
||||
- Raylib: https://github.com/raysan5/raylib
|
||||
- Lua: https://www.lua.org/
|
||||
- Zed Editor: https://zed.dev/
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ When you're ready to ship your game, you can embed all Lua files and asset files
|
||||
|
||||
## Development vs Release Workflow
|
||||
|
||||
### 🔧 Development Build (Fast Iteration)
|
||||
Development Build (Fast Iteration)
|
||||
|
||||
During development, use external files for quick iteration:
|
||||
During development, use external files for quick iteration.
|
||||
|
||||
**Setup:**
|
||||
Setup:
|
||||
```
|
||||
GameFolder/
|
||||
├── ReiLua.exe
|
||||
@@ -19,24 +19,24 @@ GameFolder/
|
||||
└── music.wav
|
||||
```
|
||||
|
||||
**Build:**
|
||||
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
|
||||
Benefits:
|
||||
- Edit Lua files and re-run immediately
|
||||
- Edit assets and reload
|
||||
- Fast development cycle
|
||||
- Debug with `--log` flag
|
||||
|
||||
### 📦 Release Build (Single Executable)
|
||||
Release Build (Single Executable)
|
||||
|
||||
For distribution, embed everything into one file:
|
||||
For distribution, embed everything into one file.
|
||||
|
||||
**Setup:**
|
||||
Setup:
|
||||
```bash
|
||||
cd build
|
||||
|
||||
@@ -50,7 +50,7 @@ copy ..\player.png assets\
|
||||
copy ..\music.wav assets\
|
||||
```
|
||||
|
||||
**Build:**
|
||||
Build:
|
||||
```bash
|
||||
# Configure with embedding
|
||||
cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
|
||||
@@ -59,17 +59,17 @@ cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
**Result:**
|
||||
Result:
|
||||
```
|
||||
Distribution/
|
||||
└── YourGame.exe (Everything embedded!)
|
||||
```
|
||||
|
||||
**Benefits:**
|
||||
- ✅ Single executable file
|
||||
- ✅ No external dependencies
|
||||
- ✅ Users can't modify game files
|
||||
- ✅ Smaller download (no separate files)
|
||||
Benefits:
|
||||
- Single executable file
|
||||
- No external dependencies
|
||||
- Users can't modify game files
|
||||
- Smaller download (no separate files)
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -143,13 +143,13 @@ MyGame/
|
||||
|
||||
### Step 2: Customize Branding (Optional)
|
||||
|
||||
**Change executable icon:**
|
||||
Change executable icon:
|
||||
```bash
|
||||
# Replace ReiLua's icon with yours
|
||||
copy MyGame\icon.ico ReiLua\icon.ico
|
||||
```
|
||||
|
||||
**Edit executable properties:**
|
||||
Edit executable properties:
|
||||
Open `ReiLua\resources.rc` and modify:
|
||||
```rc
|
||||
VALUE "CompanyName", "Your Studio Name"
|
||||
@@ -158,7 +158,7 @@ VALUE "ProductName", "Your Game Name"
|
||||
VALUE "LegalCopyright", "Copyright (C) Your Name, 2025"
|
||||
```
|
||||
|
||||
**Change executable name:**
|
||||
Change executable name:
|
||||
Edit `ReiLua\CMakeLists.txt`:
|
||||
```cmake
|
||||
project( YourGameName ) # Change from "ReiLua"
|
||||
@@ -171,7 +171,7 @@ See [CUSTOMIZATION.md](CUSTOMIZATION.md) for full details.
|
||||
**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
|
||||
-- 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")
|
||||
@@ -220,9 +220,9 @@ YourGameName.exe
|
||||
```
|
||||
|
||||
Check console output for:
|
||||
- ✅ "ReiLua x.x.x" version info
|
||||
- ✅ No file loading errors
|
||||
- ✅ Game runs correctly
|
||||
- "ReiLua x.x.x" version info
|
||||
- No file loading errors
|
||||
- Game runs correctly
|
||||
|
||||
### Step 6: Package for Distribution
|
||||
|
||||
@@ -247,26 +247,26 @@ Your game is now ready to distribute as a single executable!
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
**Problem: "No .lua files found in build directory"**
|
||||
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"**
|
||||
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**
|
||||
Problem: Game crashes on startup
|
||||
```bash
|
||||
# Solution: Run with --log to see error messages
|
||||
YourGameName.exe --log
|
||||
```
|
||||
|
||||
**Problem: Assets not loading**
|
||||
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
|
||||
|
||||
@@ -21,10 +21,10 @@ Each splash screen:
|
||||
|
||||
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
|
||||
- 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
|
||||
|
||||
@@ -149,8 +149,7 @@ Here's what a typical game startup looks like with everything enabled:
|
||||
ReiLua.exe MyGame/
|
||||
```
|
||||
|
||||
**User Experience:**
|
||||
|
||||
User Experience:
|
||||
1. **Splash Screen 1** (4.1 seconds)
|
||||
- Custom text displayed in bold (default: "YOUR STUDIO NAME")
|
||||
- Red background (Raylib color #E62937)
|
||||
|
||||
@@ -91,7 +91,7 @@ Successfully ported embedded assets, splash screens, and asset loading features
|
||||
|
||||
### Quick Build (Recommended)
|
||||
|
||||
**Development (Fast Iteration):**
|
||||
Development (Fast Iteration):
|
||||
```bash
|
||||
# Windows
|
||||
scripts\build_dev.bat
|
||||
@@ -100,7 +100,7 @@ scripts\build_dev.bat
|
||||
scripts/build_dev.sh
|
||||
```
|
||||
|
||||
**Release (Single Executable):**
|
||||
Release (Single Executable):
|
||||
```bash
|
||||
# Copy files to build directory first
|
||||
cd build
|
||||
@@ -120,7 +120,7 @@ scripts/build_release.sh
|
||||
|
||||
### Manual Build
|
||||
|
||||
**Development Build (Fast Iteration):**
|
||||
Development Build (Fast Iteration):
|
||||
```bash
|
||||
cmake -G "MinGW Makefiles" ..
|
||||
mingw32-make
|
||||
@@ -129,7 +129,7 @@ mingw32-make
|
||||
- Fast edit-and-run workflow
|
||||
- Use `--no-logo` to skip splash screens
|
||||
|
||||
**Release Build (Single Executable):**
|
||||
Release Build (Single Executable):
|
||||
```bash
|
||||
# Copy Lua files and assets to build directory
|
||||
copy ..\*.lua .
|
||||
@@ -157,14 +157,14 @@ Options:
|
||||
```
|
||||
|
||||
## 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
|
||||
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
|
||||
|
||||
@@ -178,10 +178,10 @@ 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.)
|
||||
- Function suggestions when typing `RL.`
|
||||
- Parameter hints when calling functions
|
||||
- Documentation on hover
|
||||
- Constant values (RL.RED, RL.KEY_SPACE, etc.)
|
||||
|
||||
---
|
||||
|
||||
@@ -237,7 +237,7 @@ Add these to suppress common false positives:
|
||||
}
|
||||
```
|
||||
|
||||
**Common warnings and what they mean:**
|
||||
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)
|
||||
@@ -267,7 +267,7 @@ function RL.init() end
|
||||
RL.init = nil
|
||||
```
|
||||
|
||||
**Fix Steps:**
|
||||
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
|
||||
@@ -277,11 +277,11 @@ RL.init = nil
|
||||
```
|
||||
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
|
||||
Benefits of the new approach:
|
||||
- No duplicate warnings
|
||||
- Still get autocomplete
|
||||
- Still get documentation on hover
|
||||
- Still get type checking
|
||||
|
||||
---
|
||||
|
||||
@@ -431,4 +431,4 @@ Then copy `tools/ReiLua_API.lua` to your project root, and you're ready to go!
|
||||
|
||||
---
|
||||
|
||||
**Happy Coding! 🚀**
|
||||
Happy Coding!
|
||||
|
||||
34
html_docs/README.md
Normal file
34
html_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.
|
||||
174
html_docs/generate.py
Normal file
174
html_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
html_docs/index.html
Normal file
15
html_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
html_docs/manual.html
Normal file
2144
html_docs/manual.html
Normal file
File diff suppressed because it is too large
Load Diff
6023
html_docs/reference.html
Normal file
6023
html_docs/reference.html
Normal file
File diff suppressed because it is too large
Load Diff
136
html_docs/style.css
Normal file
136
html_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