A web-based LVGL simulator built with Emscripten that compiles to WebAssembly. This project provides a browser-based environment for testing and developing LVGL user interfaces with support for multiple LVGL versions and configurable display dimensions.
- Multi-version LVGL Support: Compatible with LVGL versions 8.4.0, 9.2.2, 9.3.0, and 9.4.0
- Configurable Display: Customizable display width and height
- WebAssembly-based: Runs directly in the browser with no native compilation required
- SDL2 Integration: Uses SDL2 for rendering and input handling
- FreeType Support: Built-in TrueType font rendering
This repository can be used with studio-docker-build-tool for automated Docker-based builds and deployment workflows.
- Clone the repository:
git clone <repository-url>
cd lvgl-simulator-for-studio-docker-build- Initialize submodules:
git submodule update --init --recursiveBuild the simulator with a specific LVGL version and display dimensions:
./build.sh --lvgl=<version> [--display-width=<width>] [--display-height=<height>]Example:
./build.sh --lvgl=9.4.0 --display-width=480 --display-height=272Arguments:
--lvgl=<version>(required): LVGL version to use (e.g., 8.4.0, 9.2.2, 9.3.0, 9.4.0)--display-width=<width>(optional): Display width in pixels--display-height=<height>(optional): Display height in pixels
After building, open build/index.html in a web browser to run the simulator.
.
├── build.sh # Build script
├── CMakeLists.txt # CMake configuration
├── main.c # Main application entry point
├── lv_conf.h # LVGL configuration
├── lv_drv_conf.h # LVGL drivers configuration
├── src/ # Source files for UI
│ └── ui/ # UI components
├── versions/ # Version-specific configurations
│ ├── 8.4.0/
│ ├── 9.2.2/
│ ├── 9.3.0/
│ └── 9.4.0/
├── lvgl/ # LVGL library (submodule)
└── lv_drivers/ # LVGL drivers (submodule)
Place your generated UI files in the src/ directory:
src/screens.c/src/screens.h- Screen definitionssrc/ui.c/src/ui.h- UI initializationsrc/images/- Image assetssrc/fonts/- Font files
The build system automatically includes all .c and .cpp files from the src/ directory.
- Create a new directory under
versions/<version>/ - Add version-specific configuration files (
CMakeLists.txt,lv_conf.h, etc.) - Ensure LVGL submodule has the corresponding version tag
Edit the CMakeLists.txt file in the respective version directory to:
- Modify compiler flags
- Adjust memory settings
- Enable/disable LVGL features
- Ensure Emscripten is properly installed and activated
- Check that all submodules are initialized
- Verify the LVGL version exists as a tag in the submodule
These warnings can be safely ignored. They occur due to file timestamp differences.
Ensure all required functions (e.g., ui_init, ui_tick) are implemented in your UI files.
This project is licensed under the MIT License - see the LICENSE file for details.
- LVGL - Light and Versatile Graphics Library
- Emscripten - WebAssembly compiler toolchain
- SDL2 - Simple DirectMedia Layer