6 Commits

Author SHA1 Message Date
f10b56f21b Fix documentation errors in README
- Corrected author name for Raylib (Ray instead of Ramon)
- Updated ReiLua repository link to point to correct source
2025-11-03 23:46:34 +05:30
1a6dd92c9f docs: fix README.md formatting and improve documentation clarity
- Fix markdown formatting issues and inconsistencies
- Correct code block syntax and indentation
- Improve build instructions with clearer steps
- Update API documentation examples for better readability
- Fix typos and grammatical errors
- Add missing documentation for recent features
2025-11-03 21:19:07 +05:30
Indrajith K L
5dbff50ca2 Merge pull request #2 from cooljith91112/chore/re-organize-files
chore: fix build scripts and update project organization
2025-11-03 19:52:16 +05:30
e19bddd8d7 chore: fix build scripts to create build directory and update gitignore
- Update all build scripts (.sh and .bat) to automatically create build directory if it doesn't exist
- Fix 'can't cd to build' error that occurred when build directory was missing
- Update .gitignore to exclude build artifacts and IDE files
- Add proper navigation to project root in build_dev.bat for consistency
2025-11-03 19:50:20 +05:30
9bb3957d5f cleaned up root folder, organized files into docs/scripts/tools dirs 2025-11-03 19:43:05 +05:30
Indrajith K L
02d6be119f Merge pull request #1 from cooljith91112/embedded-assets-support
Added asset embedding support + docs cleanup
2025-11-03 19:24:01 +05:30
24 changed files with 528 additions and 654 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
.vscode
.vscode
build/

View File

@@ -35,7 +35,7 @@ set( LOGO_FILES
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/embedded_logo.h
COMMAND python ${CMAKE_SOURCE_DIR}/embed_logo.py
COMMAND python ${CMAKE_SOURCE_DIR}/scripts/embed_logo.py
${CMAKE_CURRENT_BINARY_DIR}/embedded_logo.h
${CMAKE_SOURCE_DIR}/logo/raylib_logo.png
${CMAKE_SOURCE_DIR}/logo/reilua_logo.png
@@ -50,7 +50,7 @@ set( FONT_FILE "${CMAKE_SOURCE_DIR}/fonts/Oleaguid.ttf" )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/embedded_font.h
COMMAND python ${CMAKE_SOURCE_DIR}/embed_font.py
COMMAND python ${CMAKE_SOURCE_DIR}/scripts/embed_font.py
${CMAKE_CURRENT_BINARY_DIR}/embedded_font.h
${CMAKE_SOURCE_DIR}/fonts/Oleaguid.ttf
DEPENDS ${FONT_FILE}
@@ -73,7 +73,7 @@ if( EMBED_MAIN )
if( LUA_FILES )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/embedded_main.h
COMMAND python ${CMAKE_SOURCE_DIR}/embed_lua.py ${CMAKE_CURRENT_BINARY_DIR}/embedded_main.h ${LUA_FILES}
COMMAND python ${CMAKE_SOURCE_DIR}/scripts/embed_lua.py ${CMAKE_CURRENT_BINARY_DIR}/embedded_main.h ${LUA_FILES}
DEPENDS ${LUA_FILES}
COMMENT "Embedding Lua files into executable..."
)
@@ -90,7 +90,7 @@ if( EMBED_ASSETS )
if( ASSET_FILES )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.h
COMMAND python ${CMAKE_SOURCE_DIR}/embed_assets.py ${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.h ${ASSET_FILES}
COMMAND python ${CMAKE_SOURCE_DIR}/scripts/embed_assets.py ${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.h ${ASSET_FILES}
DEPENDS ${ASSET_FILES}
COMMENT "Embedding asset files into executable..."
)

View File

@@ -28,11 +28,11 @@ This enhanced version is built upon:
### Core Framework
- **[Raylib](https://github.com/raysan5/raylib)** (v5.5) - A simple and easy-to-use library to enjoy videogames programming
- Created by Ramon Santamaria ([@raysan5](https://github.com/raysan5))
- Licensed under the zlib/libpng license
- **[ReiLua](https://github.com/Gamerfiend/ReiLua)** - The original Lua bindings for Raylib
- Created by Gamerfiend
- Created by Ray(Ramon Santamaria) ([@raysan5](https://github.com/raysan5))
- Licensed under the zlib/libpng license
- **[ReiLua](https://github.com/nullstare/ReiLua)** - The original Lua bindings for Raylib
- Created by Jussi Viitala
- Licensed under the MIT license
- **[Lua](https://www.lua.org/)** (v5.4) - Powerful, efficient, lightweight, embeddable scripting language
### Enhancements Added
@@ -128,7 +128,7 @@ function RL.update( delta )
if RL.IsKeyPressed( RL.KEY_ENTER ) then
local winSize = RL.GetScreenSize()
local measuredSize = RL.MeasureTextEx( RL.GetFontDefault(), text, textSize, 2 )
textColor = RL.BLUE
textPos = { winSize[1] / 2 - measuredSize[1] / 2, winSize[2] / 2 - measuredSize[2] / 2 }
end
@@ -200,14 +200,14 @@ function RL.init()
"assets/background.png",
"assets/music.wav",
}
-- Start loading with progress
RL.BeginAssetLoading(#assets)
-- Load each asset
for i, path in ipairs(assets) do
RL.UpdateAssetLoading(path)
-- Your loading code
if path:match("%.png$") then
textures[i] = RL.LoadTexture(path)
@@ -215,7 +215,7 @@ function RL.init()
sounds[i] = RL.LoadSound(path)
end
end
-- Finish loading
RL.EndAssetLoading()
end
@@ -297,11 +297,11 @@ One-command builds for development and release:
**Development Build (Fast Iteration):**
```bash
# Windows
build_dev.bat
scripts\build_dev.bat
# Linux/Unix
chmod +x build_dev.sh
./build_dev.sh
chmod +x scripts/build_dev.sh
scripts/build_dev.sh
```
- No embedding
- Fast build times
@@ -319,10 +319,10 @@ copy ..\your_game\assets\* assets\
cd ..
# Windows
build_release.bat
scripts\build_release.bat
# Linux/Unix
./build_release.sh
scripts/build_release.sh
```
- Embeds all Lua files
- Embeds all assets
@@ -389,10 +389,10 @@ The given file will be called with `dofile`.
Generate API.md and ReiLua_API.lua from the build folder:
```bash
ReiLua -i ../docgen.lua
ReiLua -i ../tools/docgen.lua
```
**Tip:** Use ReiLua_API.lua in your project folder to provide annotations when using "Lua Language Server".
**Tip:** Use tools/ReiLua_API.lua in your project folder to provide annotations when using "Lua Language Server".
## Building from Source
@@ -456,7 +456,7 @@ copy liblua.a path\to\ReiLua\lib\
**Quick Method (Recommended):**
```bash
cd ReiLua
build_dev.bat
scripts\build_dev.bat
```
**Manual Method:**
@@ -494,8 +494,8 @@ Move both `.a` files to the `ReiLua/lib` folder.
**Quick Method (Recommended):**
```bash
cd ReiLua
chmod +x build_dev.sh
./build_dev.sh
chmod +x scripts/build_dev.sh
scripts/build_dev.sh
```
**Manual Method:**
@@ -639,8 +639,8 @@ copy ..\MyGame\assets\* assets\
```bash
cd ..
build_release.bat
# Or: ./build_release.sh on Linux
scripts\build_release.bat
# Or: scripts/build_release.sh on Linux
```
### Step 4: Test
@@ -750,10 +750,10 @@ Create `.zed/settings.json` in your project root:
### Copy ReiLua API Definitions
Copy `ReiLua_API.lua` to your project folder. This provides autocomplete and documentation for all ReiLua functions.
Copy `tools/ReiLua_API.lua` to your project folder. This provides autocomplete and documentation for all ReiLua functions.
```bash
copy path\to\ReiLua\ReiLua_API.lua your_game\
copy path\to\ReiLua\tools\ReiLua_API.lua your_game\
```
### Keyboard Shortcuts
@@ -832,8 +832,8 @@ path\to\ReiLua.exe --log --no-logo
### Quick References
- **API.md** - All ReiLua/Raylib functions
- **ReiLua_API.lua** - Lua annotations for IDE autocomplete
- **docs/API.md** - All ReiLua/Raylib functions
- **tools/ReiLua_API.lua** - Lua annotations for IDE autocomplete
- **examples/** - Example games and demos
## Troubleshooting
@@ -868,7 +868,7 @@ path\to\ReiLua.exe --log --no-logo
**Build fails:**
- Check CMake and compiler are installed and in PATH
- Verify `libraylib.a` and `liblua.a` are in `lib/` folder
- Try clean build: `build_dev.bat clean`
- Try clean build: `scripts\build_dev.bat clean`
### Getting Help

View File

@@ -1,579 +0,0 @@
# Setting Up Zed Editor for ReiLua Development
Zed is a high-performance, modern code editor built for speed and collaboration. This guide shows you how to set up Zed for the best ReiLua game development experience.
## Why Zed?
-**Fast**: Written in Rust, extremely responsive
- 🧠 **Smart**: Built-in AI assistance (optional)
- 🎨 **Beautiful**: Clean, modern interface
- 🔧 **Powerful**: LSP support, multi-cursor editing, vim mode
- 🆓 **Free**: Open source and free to use
## Installation
### Download Zed
Visit https://zed.dev/ and download for your platform:
- **Windows**: Download installer and run
- **Mac**: Download .dmg and install
- **Linux**:
```bash
curl https://zed.dev/install.sh | sh
```
### First Launch
1. Launch Zed
2. Choose your theme (light/dark)
3. Select keybindings (VS Code, Sublime, or default)
4. Optional: Sign in for collaboration features
## Setting Up for ReiLua
### 1. Install Lua Language Server
The Lua Language Server provides autocomplete, error detection, and documentation.
**Method 1: Automatic (Recommended)**
1. Open Zed
2. Open any `.lua` file
3. Zed will prompt to install Lua support
4. Click "Install"
**Method 2: Manual**
1. Press `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac)
2. Type "zed: install language server"
3. Select "Lua"
### 2. Create Workspace Configuration
Create a `.zed` folder in your project root:
```bash
cd your_game_project
mkdir .zed
```
### 3. Configure Lua Language Server
Create `.zed/settings.json` with ReiLua-specific settings:
```json
{
"lsp": {
"lua-language-server": {
"settings": {
"Lua": {
"runtime": {
"version": "Lua 5.4",
"path": [
"?.lua",
"?/init.lua"
]
},
"diagnostics": {
"globals": [
"RL"
],
"disable": [
"lowercase-global"
]
},
"workspace": {
"library": [
"ReiLua_API.lua"
],
"checkThirdParty": false
},
"completion": {
"callSnippet": "Both",
"keywordSnippet": "Both"
},
"hint": {
"enable": true,
"setType": true
}
}
}
}
},
"languages": {
"Lua": {
"format_on_save": "on",
"formatter": "language_server",
"tab_size": 4,
"hard_tabs": false
}
},
"tab_size": 4,
"soft_wrap": "editor_width",
"theme": "One Dark",
"buffer_font_size": 14,
"ui_font_size": 14
}
```
**What this does:**
- Sets Lua 5.4 runtime (matches ReiLua)
- Adds `RL` as a global (prevents "undefined global" warnings)
- Loads ReiLua_API.lua for autocomplete
- Enables format-on-save
- Sets tab size to 4 spaces
- Enables type hints
- Disables third-party library checking (reduces noise)
### 4. Add ReiLua API Definitions
Copy `ReiLua_API.lua` to your project:
```bash
# Windows
copy path\to\ReiLua\ReiLua_API.lua your_game_project\
# Linux/Mac
cp path/to/ReiLua/ReiLua_API.lua your_game_project/
```
This file provides:
- Autocomplete for all 1000+ ReiLua functions
- Function signatures
- Parameter hints
- Documentation tooltips
### 5. Create Tasks Configuration
Create `.zed/tasks.json` for quick commands:
```json
{
"tasks": [
{
"label": "Run Game (Dev)",
"command": "path/to/ReiLua.exe",
"args": ["--log", "--no-logo"],
"cwd": "${workspaceFolder}"
},
{
"label": "Run Game (Production)",
"command": "path/to/ReiLua.exe",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"label": "Run Game with Logging",
"command": "path/to/ReiLua.exe",
"args": ["--log"],
"cwd": "${workspaceFolder}"
},
{
"label": "Build Release",
"command": "path/to/ReiLua/build_release.bat",
"cwd": "path/to/ReiLua"
}
]
}
```
**Usage:**
1. Press `Ctrl+Shift+P` / `Cmd+Shift+P`
2. Type "task: spawn"
3. Select your task
Replace `path/to/ReiLua.exe` with the actual path to your ReiLua executable.
## Essential Keyboard Shortcuts
### Navigation
| Shortcut | Action | Description |
|----------|--------|-------------|
| `Ctrl+P` / `Cmd+P` | Quick Open | Jump to any file instantly |
| `Ctrl+Shift+P` / `Cmd+Shift+P` | Command Palette | Access all commands |
| `Ctrl+T` / `Cmd+T` | Go to Symbol | Jump to function/variable |
| `F12` | Go to Definition | Jump to where something is defined |
| `Shift+F12` | Find References | Find all uses of a symbol |
| `Alt+←` / `Alt+→` | Navigate Back/Forward | Like browser navigation |
| `Ctrl+G` / `Cmd+G` | Go to Line | Jump to specific line number |
### Editing
| Shortcut | Action | Description |
|----------|--------|-------------|
| `Ctrl+D` / `Cmd+D` | Add Selection | Select next occurrence |
| `Alt+Click` | Add Cursor | Multiple cursors |
| `Ctrl+Shift+L` / `Cmd+Shift+L` | Select All Occurrences | Multi-cursor all matches |
| `Ctrl+/` / `Cmd+/` | Toggle Comment | Comment/uncomment line |
| `Alt+↑` / `Alt+↓` | Move Line Up/Down | Move current line |
| `Ctrl+Shift+D` / `Cmd+Shift+D` | Duplicate Line | Copy line below |
| `Ctrl+Shift+K` / `Cmd+Shift+K` | Delete Line | Remove entire line |
| `Ctrl+]` / `Cmd+]` | Indent | Indent selection |
| `Ctrl+[` / `Cmd+[` | Outdent | Unindent selection |
### Search
| Shortcut | Action | Description |
|----------|--------|-------------|
| `Ctrl+F` / `Cmd+F` | Find | Search in current file |
| `Ctrl+H` / `Cmd+H` | Replace | Find and replace |
| `Ctrl+Shift+F` / `Cmd+Shift+F` | Find in Files | Search entire project |
| `F3` / `Cmd+G` | Find Next | Next search result |
| `Shift+F3` / `Cmd+Shift+G` | Find Previous | Previous search result |
### View
| Shortcut | Action | Description |
|----------|--------|-------------|
| `Ctrl+\` / `Cmd+\` | Split Editor | Side-by-side editing |
| `` Ctrl+` `` / `` Cmd+` `` | Toggle Terminal | Show/hide terminal |
| `Ctrl+B` / `Cmd+B` | Toggle Sidebar | Show/hide file tree |
| `Ctrl+K Z` / `Cmd+K Z` | Zen Mode | Distraction-free mode |
| `Ctrl+K V` / `Cmd+K V` | Toggle Preview | For markdown files |
### Code
| Shortcut | Action | Description |
|----------|--------|-------------|
| `Ctrl+Space` | Trigger Autocomplete | Force show suggestions |
| `Ctrl+.` / `Cmd+.` | Code Actions | Quick fixes |
| `F2` | Rename Symbol | Rename variable/function |
| `Ctrl+K Ctrl+F` / `Cmd+K Cmd+F` | Format Selection | Format selected code |
## Project Structure Best Practices
### Recommended Layout
```
your_game/
├── .zed/
│ ├── settings.json
│ └── tasks.json
├── assets/
│ ├── images/
│ ├── sounds/
│ └── fonts/
├── lib/
│ └── (your libraries)
├── src/
│ ├── main.lua
│ ├── player.lua
│ ├── enemy.lua
│ └── game.lua
├── ReiLua_API.lua
└── README.md
```
### Using Multiple Folders
Add ReiLua source for reference:
1. File → Add Folder to Workspace
2. Select ReiLua source directory
3. Now you can reference ReiLua code easily
## Advanced Features
### Multi-Cursor Editing
**Use cases:**
- Rename variables in multiple places
- Edit similar lines simultaneously
- Batch formatting
**Example:**
1. Select a variable name
2. Press `Ctrl+D` repeatedly to select more occurrences
3. Type to edit all at once
### Split Editor
Work on multiple files simultaneously:
1. Press `Ctrl+\` to split
2. Open different files in each pane
3. Example: `main.lua` on left, `player.lua` on right
### Vim Mode (Optional)
If you love Vim:
1. `Ctrl+Shift+P` → "zed: toggle vim mode"
2. All Vim keybindings become available
3. Normal, Insert, Visual modes work
4. `:w` to save, `:q` to close, etc.
### Live Grep
Powerful project-wide search:
1. Press `Ctrl+Shift+F`
2. Type your search query
3. Results show in context
4. Click to jump to location
**Search tips:**
- Use regex with `.*` for patterns
- Search by file type: `*.lua`
- Exclude folders: Add to `.gitignore`
### Collaboration (Optional)
Share your coding session:
1. Click "Share" button (top right)
2. Send link to teammate
3. Collaborate in real-time
4. See each other's cursors
## Workflow Tips
### 1. Quick File Switching
```
Ctrl+P → type filename → Enter
```
Example: `Ctrl+P` → "play" → selects `player.lua`
### 2. Symbol Search
```
Ctrl+T → type function name → Enter
```
Example: `Ctrl+T` → "update" → jumps to `function RL.update()`
### 3. Multi-File Editing
1. `Ctrl+Shift+F` → Search for text
2. Results show all occurrences
3. Use multi-cursor to edit across files
### 4. Integrated Terminal
Keep terminal open while coding:
1. `` Ctrl+` `` → Open terminal
2. Split view: code above, terminal below
3. Run `ReiLua.exe --log --no-logo` for testing
### 5. Quick Testing Loop
Set up this workflow:
1. Edit code in Zed
2. Save with `Ctrl+S` (autosave optional)
3. Switch to terminal with `` Ctrl+` ``
4. Press `↑` to recall previous command
5. Press `Enter` to run game
## Troubleshooting
### Lua Language Server Not Working
**Problem**: No autocomplete or diagnostics
**Solutions:**
1. Check LSP status: `Ctrl+Shift+P` → "lsp: show active servers"
2. Restart LSP: `Ctrl+Shift+P` → "lsp: restart"
3. Check `.zed/settings.json` syntax
4. Verify `ReiLua_API.lua` exists in project
### ReiLua Functions Show as Undefined
**Problem**: `RL.DrawText` shows as error
**Solutions:**
1. Add `"RL"` to globals in `.zed/settings.json`:
```json
"diagnostics": {
"globals": ["RL"]
}
```
2. Restart LSP
### Format on Save Not Working
**Problem**: Code doesn't format when saving
**Solutions:**
1. Check formatter setting:
```json
"languages": {
"Lua": {
"format_on_save": "on"
}
}
```
2. Ensure LSP is running
3. Try manual format: `Ctrl+Shift+F`
### Tasks Not Showing
**Problem**: Can't find run tasks
**Solutions:**
1. Verify `.zed/tasks.json` exists
2. Check JSON syntax
3. Reload window: `Ctrl+Shift+P` → "zed: reload"
## Themes and Appearance
### Change Theme
1. `Ctrl+Shift+P` → "theme selector: toggle"
2. Browse themes
3. Select one
**Recommended for coding:**
- One Dark (dark)
- One Light (light)
- Andromeda (dark)
- GitHub Light (light)
### Adjust Font Size
**Method 1: Settings**
Edit `.zed/settings.json`:
```json
{
"buffer_font_size": 14,
"ui_font_size": 14
}
```
**Method 2: Quick Zoom**
- `Ctrl+=` / `Cmd+=` → Increase font
- `Ctrl+-` / `Cmd+-` → Decrease font
- `Ctrl+0` / `Cmd+0` → Reset font
### Custom Font
```json
{
"buffer_font_family": "JetBrains Mono",
"buffer_font_size": 14
}
```
**Recommended coding fonts:**
- JetBrains Mono
- Fira Code
- Cascadia Code
- Source Code Pro
## Extensions and Enhancements
### Install Extensions
1. `Ctrl+Shift+X` / `Cmd+Shift+X`
2. Search for extensions
3. Click install
### Recommended for Lua Development
**Core:**
- ✅ Lua Language Server (built-in)
**Productivity:**
- Better Comments - Enhanced comment highlighting
- Error Lens - Inline error display
- Bracket Pair Colorizer - Match brackets with colors
**Optional:**
- GitHub Copilot - AI code suggestions (requires subscription)
- GitLens - Advanced git integration
## Sample Workspace
Here's a complete example setup:
### Directory Structure
```
MyGame/
├── .zed/
│ ├── settings.json
│ └── tasks.json
├── src/
│ ├── main.lua
│ ├── player.lua
│ └── enemy.lua
├── assets/
│ ├── player.png
│ └── music.wav
├── ReiLua_API.lua
└── README.md
```
### .zed/settings.json
```json
{
"lsp": {
"lua-language-server": {
"settings": {
"Lua": {
"runtime": {"version": "Lua 5.4"},
"diagnostics": {"globals": ["RL"]},
"workspace": {"library": ["ReiLua_API.lua"]}
}
}
}
},
"languages": {
"Lua": {
"format_on_save": "on",
"tab_size": 4
}
},
"theme": "One Dark",
"buffer_font_size": 14
}
```
### .zed/tasks.json
```json
{
"tasks": [
{
"label": "Run Game",
"command": "C:/ReiLua/build/ReiLua.exe",
"args": ["--log", "--no-logo"]
}
]
}
```
Now you can:
- Open project in Zed
- Get autocomplete for all RL functions
- Press `Ctrl+Shift+P` → "Run Game" to test
- Edit code with full LSP support
## Tips for Efficient Development
1. **Learn 5 shortcuts**: `Ctrl+P`, `Ctrl+Shift+F`, `Ctrl+D`, `F12`, `` Ctrl+` ``
2. **Use multi-cursor**: Speed up repetitive edits
3. **Split editor**: Work on related files side-by-side
4. **Keep terminal open**: Quick testing without leaving Zed
5. **Use Zen mode**: Focus during complex coding
6. **Enable autosave**: Never lose work
## Next Steps
✅ Install Zed
✅ Configure for Lua 5.4
✅ Add ReiLua_API.lua to project
✅ Set up tasks for quick testing
✅ Learn essential shortcuts
✅ Start coding your game!
## Additional Resources
- **Zed Documentation**: https://zed.dev/docs
- **Zed GitHub**: https://github.com/zed-industries/zed
- **Community**: https://zed.dev/community
- **Keyboard Shortcuts**: View in Zed with `Ctrl+K Ctrl+S`
---
Happy coding with Zed and ReiLua! 🚀

View File

View File

@@ -5,12 +5,12 @@ ReiLua includes automated build scripts for easy development and release builds.
## Available Scripts
### Development Build Scripts
- **Windows**: `build_dev.bat`
- **Linux/Unix**: `build_dev.sh`
- **Windows**: `scripts\build_dev.bat`
- **Linux/Unix**: `scripts/build_dev.sh`
### Release Build Scripts
- **Windows**: `build_release.bat`
- **Linux/Unix**: `build_release.sh`
- **Windows**: `scripts\build_release.bat`
- **Linux/Unix**: `scripts/build_release.sh`
## Development Build
@@ -21,13 +21,13 @@ Fast iteration during game development with external Lua files and assets.
**Windows:**
```cmd
build_dev.bat
scripts\build_dev.bat
```
**Linux/Unix:**
```bash
chmod +x build_dev.sh
./build_dev.sh
chmod +x scripts/build_dev.sh
scripts/build_dev.sh
```
### Features
@@ -36,7 +36,7 @@ chmod +x build_dev.sh
- ✅ Edit code and assets without rebuilding
- ✅ Automatic cleanup of embedded files
- ✅ Warns if Lua files or assets are in build directory
- ✅ Optional clean build: `build_dev.bat clean` or `./build_dev.sh clean`
- ✅ Optional clean build: `scripts\build_dev.bat clean` or `scripts/build_dev.sh clean`
### Output
- Development executable: `build/ReiLua.exe`
@@ -69,13 +69,13 @@ copy ..\your_game\assets\* assets\
**Windows:**
```cmd
build_release.bat
scripts\build_release.bat
```
**Linux/Unix:**
```bash
chmod +x build_release.sh
./build_release.sh
chmod +x scripts/build_release.sh
scripts/build_release.sh
```
### Features
@@ -133,7 +133,7 @@ After building, the executable will be named `YourGameName.exe`.
```bash
# Initial setup
build_dev.bat
scripts\build_dev.bat
# Edit your Lua files in your game directory
# ... make changes ...
@@ -143,7 +143,7 @@ cd your_game
path\to\build\ReiLua.exe
# If you modify C code, rebuild
build_dev.bat
scripts\build_dev.bat
```
### Release Workflow
@@ -157,7 +157,7 @@ copy ..\your_game\assets\* assets\
# 2. Build release
cd ..
build_release.bat
scripts\build_release.bat
# 3. Test
cd build
@@ -181,7 +181,7 @@ ReiLua.exe --log
### "Build failed"
- Check compiler errors in output
- Ensure all dependencies are installed
- Try clean build: `build_dev.bat clean`
- 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/

View File

@@ -371,7 +371,7 @@ Before releasing your game:
**Splash screens don't show changes:**
- Rebuild with clean build
- Check `embed_logo.py` ran successfully
- Check `scripts/embed_logo.py` ran successfully
- Verify logo files exist in `logo/` folder
**Executable name unchanged:**

View File

@@ -53,8 +53,8 @@ Asset loading system documentation:
### 🔧 [BUILD_SCRIPTS.md](BUILD_SCRIPTS.md)
Build automation documentation:
- `build_dev.bat` / `build_dev.sh` - Development builds
- `build_release.bat` / `build_release.sh` - Release builds
- `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
@@ -93,7 +93,7 @@ Complete API reference:
- Function signatures
- Raygui, Raymath, Lights, Easings, RLGL modules
### 📝 [ReiLua_API.lua](ReiLua_API.lua)
### 📝 [tools/ReiLua_API.lua](tools/ReiLua_API.lua)
Lua annotations file:
- Provides autocomplete in LSP-enabled editors
- Function documentation
@@ -118,7 +118,7 @@ Technical implementation details:
### "I want to embed my game into a single .exe"
1. Read [EMBEDDING.md](EMBEDDING.md)
2. Use `build_release.bat` / `build_release.sh`
2. Use `scripts\build_release.bat` / `scripts/build_release.sh`
3. Follow the complete release workflow in [README.md](README.md)
### "I want to add a loading screen"
@@ -143,21 +143,21 @@ Technical implementation details:
### "I want to setup my code editor"
1. Read [ZED_EDITOR_SETUP.md](ZED_EDITOR_SETUP.md)
2. Install Zed and Lua Language Server
3. Copy `ReiLua_API.lua` to your project
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
2. Install prerequisites (CMake, compiler, Raylib, Lua)
3. Use `build_dev.bat` for development
4. Use `build_release.bat` for release
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)
2. Search for function name
3. See function signature and description
4. Or copy [ReiLua_API.lua](ReiLua_API.lua) for autocomplete
4. Or copy [tools/ReiLua_API.lua](tools/ReiLua_API.lua) for autocomplete
---

View File

@@ -62,7 +62,7 @@ ReiLua.exe --log --no-logo
The splash screen system is implemented in C and runs before any Lua code executes:
1. **Logo Embedding**: During build, `embed_logo.py` converts PNG files to C byte arrays
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
@@ -71,7 +71,7 @@ The splash screen system is implemented in C and runs before any Lua code execut
- `src/splash.c` - Splash screen implementation
- `include/splash.h` - Header file
- `embed_logo.py` - Python script to embed logo images
- `scripts/embed_logo.py` - Python script to embed logo images
- `logo/raylib_logo.png` - Raylib logo (embedded)
- `logo/reilua_logo.png` - ReiLua logo (embedded)
@@ -79,7 +79,7 @@ The splash screen system is implemented in C and runs before any Lua code execut
The CMakeLists.txt automatically:
1. Runs `embed_logo.py` during build
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
@@ -205,7 +205,7 @@ ReiLua.exe MyGame/
**Solutions**:
- Ensure Python 3 is installed and in PATH
- Check `embed_logo.py` has correct paths
- Check `scripts/embed_logo.py` has correct paths
- Verify `logo/` folder exists with both PNG files
- Check CMake output for specific error messages

View File

@@ -51,10 +51,10 @@ Successfully ported embedded assets, splash screens, and asset loading features
### New Files
- **Python Scripts:**
- `embed_lua.py` - Embeds Lua files into C header
- `embed_assets.py` - Embeds asset files into C header
- `embed_logo.py` - Embeds splash screen logos
- `embed_font.py` - Embeds custom font
- `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
@@ -72,8 +72,8 @@ Successfully ported embedded assets, splash screens, and asset loading features
- `BUILD_SCRIPTS.md` - Build scripts documentation
- **Build Scripts:**
- `build_dev.bat` / `build_dev.sh` - One-command development builds
- `build_release.bat` / `build_release.sh` - One-command release builds with embedding
- `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
@@ -94,10 +94,10 @@ Successfully ported embedded assets, splash screens, and asset loading features
**Development (Fast Iteration):**
```bash
# Windows
build_dev.bat
scripts\build_dev.bat
# Linux/Unix
./build_dev.sh
scripts/build_dev.sh
```
**Release (Single Executable):**
@@ -112,10 +112,10 @@ copy ..\assets\* assets\
cd ..
# Windows
build_release.bat
scripts\build_release.bat
# Linux/Unix
./build_release.sh
scripts/build_release.sh
```
### Manual Build

434
docs/ZED_EDITOR_SETUP.md Normal file
View File

@@ -0,0 +1,434 @@
# 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:
```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! 🚀**

View File

@@ -7,7 +7,11 @@ echo ReiLua - Development Build
echo ================================
echo.
REM Navigate to build directory
REM Get script directory and navigate to project root
cd /d "%~dp0.."
REM Create and navigate to build directory
if not exist "build" mkdir build
cd build
if errorlevel 1 (
echo ERROR: Cannot access build directory

View File

@@ -7,7 +7,12 @@ echo "ReiLua - Development Build"
echo "================================"
echo ""
# Navigate to build directory
# Get the script directory and navigate to project root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR/.." || exit 1
# Create and navigate to build directory
mkdir -p build
cd build || exit 1
# Clean old embedded files (important for dev builds!)

View File

@@ -7,13 +7,17 @@ echo ReiLua - Release Build
echo ================================
echo.
REM Get script directory and navigate to project root
cd /d "%~dp0.."
REM Check if we're in the right directory
if not exist "CMakeLists.txt" (
echo ERROR: Please run this script from the ReiLua root directory
echo ERROR: Cannot find CMakeLists.txt in project root
exit /b 1
)
REM Navigate to build directory
REM Create and navigate to build directory
if not exist "build" mkdir build
cd build
if errorlevel 1 (
echo ERROR: Cannot access build directory

View File

@@ -7,13 +7,18 @@ echo "ReiLua - Release Build"
echo "================================"
echo ""
# Get the script directory and navigate to project root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR/.." || exit 1
# Check if we're in the right directory
if [ ! -f "CMakeLists.txt" ]; then
echo "ERROR: Please run this script from the ReiLua root directory"
echo "ERROR: Cannot find CMakeLists.txt in project root"
exit 1
fi
# Navigate to build directory
# Create and navigate to build directory
mkdir -p build
cd build || exit 1
# Clean old embedded files