|
| 1 | +# SpringBoard RmlUi Conversion - Summary |
| 2 | + |
| 3 | +## What Was Accomplished |
| 4 | + |
| 5 | +A proper foundation for converting SpringBoard from Chili to RmlUi has been created. This is **not** a compatibility layer or hack - it's a proper declarative UI system using RmlUi as intended. |
| 6 | + |
| 7 | +### Core Infrastructure ✅ |
| 8 | + |
| 9 | +**RmlUi Manager** (`scen_edit/view/view_rmlui/manager.lua`) |
| 10 | +- Context creation and lifecycle management |
| 11 | +- Document loading from RML files |
| 12 | +- Input event routing (mouse, keyboard, text) |
| 13 | +- Rendering coordination |
| 14 | + |
| 15 | +**RmlUi Widget** (`LuaUI/widgets/api_sb_ui.lua`) |
| 16 | +- Spring engine integration |
| 17 | +- Input event forwarding |
| 18 | +- Rendering hooks |
| 19 | +- Layer -999 for proper draw order |
| 20 | + |
| 21 | +### UI Implementation ✅ |
| 22 | + |
| 23 | +**Main UI Template** (`scen_edit/view/view_rmlui/rml/springboard_main.rml`) |
| 24 | +- Complete declarative UI structure |
| 25 | +- Top menu, team selector, tabbed window, bottom bar |
| 26 | +- All major UI elements defined in RML |
| 27 | + |
| 28 | +**Stylesheets** (`scen_edit/view/view_rmlui/rcss/`) |
| 29 | +- `springboard.rcss` - Main UI styling |
| 30 | +- `dialog.rcss` - Dialog styling |
| 31 | +- Dark theme matching original appearance |
| 32 | +- Flexbox layouts |
| 33 | + |
| 34 | +**View Class** (`scen_edit/view/view_rmlui/view.lua`) |
| 35 | +- Loads main RML document |
| 36 | +- Binds events for all UI elements |
| 37 | +- Project menu integration (New/Open/Save/Quick Save) |
| 38 | +- Team selector |
| 39 | +- Bottom bar with status and controls |
| 40 | +- Upload log functionality |
| 41 | + |
| 42 | +### Dialogs ✅ |
| 43 | + |
| 44 | +Complete RmlUi implementations with RML templates: |
| 45 | + |
| 46 | +1. **Base Dialog** - Common dialog functionality |
| 47 | +2. **NewProjectDialog** - Create new projects |
| 48 | +3. **FileDialog** - File browser |
| 49 | +4. **SaveProjectDialog** - Save projects |
| 50 | +5. **OpenProjectDialog** - Open projects |
| 51 | + |
| 52 | +Each dialog: |
| 53 | +- Has dedicated RML template |
| 54 | +- Uses RCSS styling |
| 55 | +- Lua only for logic/events |
| 56 | +- Proper separation of concerns |
| 57 | + |
| 58 | +### Testing Infrastructure ✅ |
| 59 | + |
| 60 | +**UI Test Harness** (`scen_edit/view/view_rmlui/test/`) |
| 61 | + |
| 62 | +Allows testing UI without full SpringBoard: |
| 63 | + |
| 64 | +- Mocks Spring.RmlUi API |
| 65 | +- Mock controllers (project, team, status) |
| 66 | +- Simulates user interactions |
| 67 | +- Automated test scenarios |
| 68 | +- Realistic mock data |
| 69 | + |
| 70 | +Benefits: |
| 71 | +- Rapid development without game engine |
| 72 | +- Isolated component testing |
| 73 | +- Reproducible scenarios |
| 74 | +- CI/CD ready |
| 75 | + |
| 76 | +## Technical Approach |
| 77 | + |
| 78 | +### Proper RmlUi Usage |
| 79 | + |
| 80 | +This conversion uses RmlUi **correctly**: |
| 81 | + |
| 82 | +1. **RML Templates** - HTML-like markup for structure |
| 83 | +2. **RCSS Stylesheets** - CSS-like styling |
| 84 | +3. **Lua Logic** - Event handling and business logic only |
| 85 | + |
| 86 | +This is fundamentally different from Chili's programmatic Lua approach. |
| 87 | + |
| 88 | +### Example |
| 89 | + |
| 90 | +**RML** (structure): |
| 91 | +```xml |
| 92 | +<button id="btn-save" class="menu-button">Save</button> |
| 93 | +``` |
| 94 | + |
| 95 | +**RCSS** (styling): |
| 96 | +```css |
| 97 | +.menu-button { |
| 98 | + background-color: #3a3a3a; |
| 99 | + padding: 8dp 20dp; |
| 100 | +} |
| 101 | +.menu-button:hover { |
| 102 | + background-color: #4a4a4a; |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +**Lua** (logic only): |
| 107 | +```lua |
| 108 | +local btn = document:GetElementById("btn-save") |
| 109 | +btn:AddEventListener("click", function() |
| 110 | + SaveProject() |
| 111 | +end) |
| 112 | +``` |
| 113 | + |
| 114 | +### Separation of Concerns |
| 115 | + |
| 116 | +- **UI Structure**: RML files |
| 117 | +- **UI Styling**: RCSS files |
| 118 | +- **UI Logic**: Lua files |
| 119 | +- **Data**: Separate models/controllers |
| 120 | +- **Testing**: Mock harness |
| 121 | + |
| 122 | +## Current State |
| 123 | + |
| 124 | +### What Works |
| 125 | + |
| 126 | +- RmlUi infrastructure complete |
| 127 | +- Main UI template defined |
| 128 | +- All dialogs converted |
| 129 | +- Test harness functional |
| 130 | +- Documentation comprehensive |
| 131 | + |
| 132 | +### What's Left |
| 133 | + |
| 134 | +- 93 view files remain (original Chili code) |
| 135 | +- Need systematic conversion of: |
| 136 | + - Editor base class |
| 137 | + - Field types (15+) |
| 138 | + - Map editors (12) |
| 139 | + - Object editors (5) |
| 140 | + - Trigger system (15) |
| 141 | + - General editors (4) |
| 142 | + - Actions (14) |
| 143 | + |
| 144 | +### Progress: 11% (11/104 files) |
| 145 | + |
| 146 | +## File Organization |
| 147 | + |
| 148 | +### Current Structure |
| 149 | + |
| 150 | +``` |
| 151 | +scen_edit/ |
| 152 | +├── view/ # OLD Chili code (104 files) |
| 153 | +│ ├── dialog/ |
| 154 | +│ ├── fields/ |
| 155 | +│ ├── map/ |
| 156 | +│ ├── object/ |
| 157 | +│ ├── trigger/ |
| 158 | +│ └── ... |
| 159 | +└── view/view_rmlui/ # NEW RmlUi code (in subfolder) |
| 160 | + ├── manager.lua |
| 161 | + ├── view.lua |
| 162 | + ├── init.lua |
| 163 | + ├── dialog/ # RmlUi dialogs |
| 164 | + ├── rml/ # RML templates |
| 165 | + ├── rcss/ # Stylesheets |
| 166 | + └── test/ # Test harness |
| 167 | +``` |
| 168 | + |
| 169 | +### Intended Structure (after cleanup) |
| 170 | + |
| 171 | +``` |
| 172 | +scen_edit/ |
| 173 | +└── view/ # RmlUi code only |
| 174 | + ├── manager.lua |
| 175 | + ├── view.lua |
| 176 | + ├── init.lua |
| 177 | + ├── dialog/ |
| 178 | + ├── fields/ # To be converted |
| 179 | + ├── map/ # To be converted |
| 180 | + ├── object/ # To be converted |
| 181 | + ├── trigger/ # To be converted |
| 182 | + ├── rml/ # RML templates |
| 183 | + ├── rcss/ # Stylesheets |
| 184 | + └── test/ # Test harness |
| 185 | +``` |
| 186 | + |
| 187 | +## Engine Requirements |
| 188 | + |
| 189 | +- **BAR Engine 105.1.1+** or **Recoil Engine** |
| 190 | +- Standard Spring 104.x does **NOT** support RmlUi |
| 191 | +- Test harness works without engine (mocks RmlUi) |
| 192 | + |
| 193 | +## Testing |
| 194 | + |
| 195 | +### With BAR Engine |
| 196 | + |
| 197 | +```lua |
| 198 | +-- Load and show UI |
| 199 | +SB.Include("scen_edit/view/view_rmlui/init.lua") |
| 200 | +SB.view = ViewRmlUi() |
| 201 | +``` |
| 202 | + |
| 203 | +### Without Engine (Testing) |
| 204 | + |
| 205 | +```lua |
| 206 | +-- Use test harness |
| 207 | +SB.Include("scen_edit/view/view_rmlui/test/ui_test_harness.lua") |
| 208 | +RunUITests() |
| 209 | +``` |
| 210 | + |
| 211 | +## Next Steps |
| 212 | + |
| 213 | +### Immediate Cleanup |
| 214 | + |
| 215 | +1. **Rename**: `view/view_rmlui` → `view` (replace old Chili code) |
| 216 | +2. **Remove**: "rmlui" from all filenames |
| 217 | +3. **Remove**: "RmlUi" prefix from class names |
| 218 | +4. **Keep**: `.rml` and `.rcss` extensions as-is |
| 219 | + |
| 220 | +### Systematic Conversion |
| 221 | + |
| 222 | +For each component: |
| 223 | + |
| 224 | +1. Create RML template |
| 225 | +2. Create/update RCSS styling |
| 226 | +3. Convert Lua to load RML and bind events |
| 227 | +4. Add test to test harness |
| 228 | +5. Remove old Chili code |
| 229 | + |
| 230 | +### Priority Order |
| 231 | + |
| 232 | +1. Editor base class (needed for all editors) |
| 233 | +2. Basic field types (Numeric, String, Boolean) |
| 234 | +3. One complete editor as example (HeightmapEditor) |
| 235 | +4. Remaining field types |
| 236 | +5. Remaining editors |
| 237 | + |
| 238 | +## CI/Luacheck |
| 239 | + |
| 240 | +### Issue |
| 241 | + |
| 242 | +Current CI uses deprecated `hererocks` setup |
| 243 | + |
| 244 | +### Fix Applied |
| 245 | + |
| 246 | +Updated `.github/workflows/luacheck.yml`: |
| 247 | +- Use modern GitHub Actions: |
| 248 | + - `leafo/gh-actions-lua@v10` |
| 249 | + - `leafo/gh-actions-luarocks@v4` |
| 250 | +- Simpler, maintained approach |
| 251 | +- Should fix CI failures |
| 252 | + |
| 253 | +### Alternative |
| 254 | + |
| 255 | +If issues persist, consider: |
| 256 | +- **Selene**: Modern Lua linter (https://github.com/Kampfkarren/selene) |
| 257 | +- **StyLua**: Lua formatter (https://github.com/JohnnyMorganz/StyLua) |
| 258 | +- **LuaLS**: Lua Language Server with linting |
| 259 | + |
| 260 | +## Documentation |
| 261 | + |
| 262 | +- `RMLUI_CONVERSION.md` - Conversion guide |
| 263 | +- `FULL_CONVERSION_STATUS.md` - Detailed tracking (11%) |
| 264 | +- `scen_edit/view/view_rmlui/README.md` - Technical docs |
| 265 | +- `scen_edit/view/view_rmlui/test/README.md` - Test guide |
| 266 | + |
| 267 | +## Benefits of This Approach |
| 268 | + |
| 269 | +### Development |
| 270 | + |
| 271 | +- Fast iteration with test harness |
| 272 | +- No game engine needed for UI work |
| 273 | +- Clear separation of concerns |
| 274 | +- Modern declarative UI paradigm |
| 275 | + |
| 276 | +### Maintenance |
| 277 | + |
| 278 | +- Easier styling (CSS-like) |
| 279 | +- Better code organization |
| 280 | +- Testable components |
| 281 | +- Less Lua boilerplate |
| 282 | + |
| 283 | +### Performance |
| 284 | + |
| 285 | +- RmlUi C++ rendering vs Lua |
| 286 | +- Better layout engine |
| 287 | +- Lower memory usage |
| 288 | +- Faster input handling |
| 289 | + |
| 290 | +## Commit History |
| 291 | + |
| 292 | +1. Initial dialog conversion (dialogs + infrastructure) |
| 293 | +2. Main UI implementation (ViewRmlUi + templates) |
| 294 | +3. Test harness (standalone testing) |
| 295 | +4. CI fix (modern luacheck setup) |
| 296 | + |
| 297 | +## Branch |
| 298 | + |
| 299 | +`claude/springboard-rmlui-conversion-011CUooEurKLbWKUu8vygDUw` |
| 300 | + |
| 301 | +## Status |
| 302 | + |
| 303 | +**Foundation Complete**: Core infrastructure, dialogs, test harness ready |
| 304 | + |
| 305 | +**Next Phase**: Systematic conversion of remaining 93 files |
| 306 | + |
| 307 | +**Approach**: Proper RmlUi with RML/RCSS/Lua separation |
| 308 | + |
| 309 | +**Progress**: 11% (11/104 files) |
| 310 | + |
| 311 | +**Ready For**: Continued development following established patterns |
| 312 | + |
| 313 | +--- |
| 314 | + |
| 315 | +**Date**: 2025-11-05 |
| 316 | +**Author**: Claude |
| 317 | +**Status**: Work in Progress - Foundation Complete |
0 commit comments