Files
MosisService/docs/DESKTOP-DESIGNER.md

70 lines
2.5 KiB
Markdown

# Desktop Designer
The desktop designer (`designer/`) provides rapid UI development with:
- **Hot-reload**: Automatically reloads when RML/RCSS/Lua files change
- **UI Hierarchy Dumping**: Exports element tree to JSON for inspection
- **Screenshot Capture**: PNG export via F12 key
- **Logging**: Detailed output for debugging navigation and events
- **Action Recording**: Record mouse/keyboard interactions to JSON
- **Action Playback**: Replay recorded interactions with timing
## Key Files
| File | Purpose |
|------|---------|
| `designer/src/main.cpp` | Main entry point, GLFW window, event loop |
| `designer/src/desktop_kernel.cpp` | RmlUi context management, rendering |
| `designer/src/testing/ui_inspector.cpp` | UI hierarchy JSON export |
| `designer/src/testing/visual_capture.cpp` | PNG screenshot capture and comparison |
| `designer/src/testing/action_recorder.cpp` | Record user interactions to JSON |
| `designer/src/testing/action_player.cpp` | Playback recorded actions |
| `designer/src/backend/RmlUi_Backend_GLFW_GL3.cpp` | GLFW backend with input hooks |
## Command Line Options
```
--simulator Enable simulator mode (shows home screen with third-party apps)
--test-apps <path> Path to test-apps directory (default: auto-detect)
--assets <path> Set assets directory (default: derived from document)
--log <path> Write logs to file
--hierarchy <path> Dump UI hierarchy JSON each frame
--dump Single-shot dump mode (screenshot + hierarchy)
--record <path> Enable recording mode (F5 to start/stop)
--playback <path> Play back recorded actions from JSON
--resolution WxH Set window resolution (default: 540x960)
```
## Running the Designer
### Simulator Mode (Recommended for Testing Apps)
To run the designer with third-party test apps visible:
```bash
cd MosisService
./designer/build/Release/mosis-designer.exe --simulator --test-apps test-apps
```
This will:
- Load the home screen from `src/main/assets/apps/home/home.rml`
- Scan `test-apps/` for apps with valid `manifest.json`
- Display discovered apps in the home screen grid
- Enable the `mosis.apps` Lua API for app launching
### Direct Document Mode
To load a specific RML document directly:
```bash
./designer/build/Release/mosis-designer.exe path/to/document.rml
```
## Keyboard Controls
| Key | Function |
|-----|----------|
| F5 | Start/stop recording (when --record is enabled) |
| F6 | Pause/resume playback (when --playback is enabled) |
| F12 | Take screenshot |