# lvgl_84_develop **Repository Path**: brilliant29/lvgl_84_develop ## Basic Information - **Project Name**: lvgl_84_develop - **Description**: 本项目为在64位PC,window+VSCode+mingw64+SDL2模拟lvgl v8.4开发,README_AGENT.md可用于AI/AGENT配置环境提示词 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-11 - **Last Updated**: 2026-08-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LVGL 8.4 Windows 模拟开发基础模版 # LVGL 8.4 Windows Simulation Development Base Template --- > A base template for developing LVGL 8.4 on Windows using SDL2 simulation. Perfect for rapid prototyping without hardware. > > 一个基于 SDL2 模拟的 LVGL 8.4 Windows 开发基础模版,无需硬件即可快速开发 GUI。 --- ## What This Project Is ## 这个项目是什么 This is a **basic template** for developing LVGL 8.4 GUI on Windows PC. It provides: - 🖥️ **SDL2 window simulation** — run LVGL GUI without hardware - 🎨 **800x480 display** — common resolution for embedded displays - 🖱️ **Mouse input** — click and interact with UI elements - ⚡ **Rapid prototyping** — just add `.c/.h` files to `app_ui/` directory 这是一个 **LVGL 8.4 Windows 模拟开发基础模版**,提供: - 🖥️ **SDL2 窗口模拟** — 无需硬件即可运行 LVGL GUI - 🎨 **800x480 显示分辨率** — 嵌入式显示常用分辨率 - 🖱️ **鼠标输入** — 点击和交互 UI 元素 - ⚡ **快速开发** — 只需在 `app_ui/` 目录添加 `.c/.h` 文件即可 --- ## How to Use ## 如何使用 ### 1. Build & Run ### 1. 构建与运行 ```bash # Configure (first time or after adding new source files) # 首次配置或添加新源文件后配置 cmake -B build -G "MinGW Makefiles" # Build # 构建 mingw32-make -C build -j4 # Run # 运行 ./build/lvgl_sim.exe ``` ### 2. Add New UI Pages ### 2. 添加新 UI 页面 1. Create a new `.c` and `.h` file in `app_ui/` directory 在 `app_ui/` 目录下创建新的 `.c` 和 `.h` 文件 2. Add your UI logic in the new file (similar to `app_ui.c`) 在新文件中添加 UI 逻辑(类似 `app_ui.c`) 3. Include the new header in `app_ui.c` and call your function 在 `app_ui.c` 中包含新头文件并调用函数 4. Re-run CMake and rebuild 重新运行 CMake 和构建 ### 3. Example: Adding a New Page ### 3. 示例:添加新页面 ```c // app_ui/new_page.h #ifndef NEW_PAGE_H #define NEW_PAGE_H #include "lvgl.h" void new_page_create(lv_obj_t *parent); #endif // app_ui/new_page.c #include "new_page.h" void new_page_create(lv_obj_t *parent) { lv_obj_t *label = lv_label_create(parent); lv_label_set_text(label, "New Page"); lv_obj_center(label); } ``` Then in `app_ui.c`, include and call it: 然后在 `app_ui.c` 中包含并调用: ```c #include "new_page.h" // In your page switch logic: // 在页面切换逻辑中: new_page_create(lv_scr_act()); ``` --- ## Project Structure ## 项目结构 ``` lvgl_84_develop/ ├── main.c # Entry point: SDL init, LVGL init, main loop │ # 入口文件: SDL 初始化、LVGL 初始化、主循环 ├── app_ui/ # UI source files (auto-collected by CMake) │ ├── app_ui.c # UI logic: two pages, button switch │ └── app_ui.h # UI header ├── CMakeLists.txt # Build configuration │ # 构建配置 ├── lv_conf.h # LVGL configuration (color depth, fonts, etc.) │ # LVGL 配置 (颜色深度、字体等) ├── lv_drv_conf.h # LVGL drivers configuration (SDL enabled) │ # LVGL 驱动配置 (启用 SDL) ├── lvgl-8.4/ # LVGL library source │ # LVGL 库源码 ├── lv_drivers-8.3.0/ # LVGL drivers (SDL backend) │ # LVGL 驱动 (SDL 后端) └── SDL2-2.32.10/ # SDL2 runtime library # SDL2 运行时库 ``` --- ## Current Demo UI ## 当前演示 UI - **Page 1**: "helloworld" - **Page 2**: "I'm brilliant_29" - **Button**: "Switch" at the bottom, toggles between pages - **页面 1**: "helloworld" - **页面 2**: "I'm brilliant_29" - **按钮**: 底部 "Switch" 按钮,切换两个页面 --- ## Key Configuration ## 关键配置 | Item | Value | 说明 | |------|-------|------| | Display Resolution | 800 x 480 | 显示分辨率 | | Color Depth | RGB565 (16-bit) | 颜色深度 | | Input | SDL Mouse | 输入方式 | | Target | Windows (MinGW-w64) | 目标平台 | | LVGL Version | 8.4 | LVGL 版本 | | lv_drivers | 8.3.0 | LVGL 驱动版本 | | SDL2 | 2.32.10 | SDL2 版本 | | Font | Montserrat 14 | 字体 | --- ## VSCode Configuration ## VSCode 配置 项目包含 `.vscode/settings.json`,克隆后 VSCode 会自动识别 CMake 路径。 ### 自动配置(推荐) 1. 用 VSCode 打开项目文件夹 2. VSCode 会自动检测 `settings.json` 并配置 CMake 3. 等待 CMake 配置完成(左下角会显示进度) 4. 如果配置失败,按 `Ctrl+Shift+P` → `CMake: Delete Cache and Reconfigure` ### 手动配置 如果自动配置失败,检查 `.vscode/settings.json`: ```json { "cmake.cmakePath": "${workspaceFolder}/cmake-4.4.2-windows-x86_64/bin/cmake.exe", "cmake.generator": "MinGW Makefiles", "cmake.configureSettings": { "CMAKE_C_COMPILER": "E:/mingw64/bin/gcc.exe" } } ``` ### 常见问题 - **报错 `CMake 可执行文件错误`**:删除 `build/` 文件夹,按 `Ctrl+Shift+P` → `Reload Window` - **报错 `lvgl.h: No such file or directory`**:这是 IntelliSense 错误,CMake 配置成功后会自动解决 - **项目移动后配置失败**:删除 `build/` 文件夹,重新加载窗口 --- ## Important Notes ## 重要提示 - **`app_ui/`** directory is auto-collected by CMake — just add `.c/.h` files `app_ui/` 目录被 CMake 自动收集 — 直接添加 `.c/.h` 文件即可 - **`lv_conf.h`** controls LVGL features (fonts, colors, etc.) `lv_conf.h` 控制 LVGL 功能(字体、颜色等) - **`lv_drv_conf.h`** controls driver settings (screen size, SDL, etc.) `lv_drv_conf.h` 控制驱动设置(屏幕尺寸、SDL 等) - **Entry function**: `app_ui()` in `app_ui/app_ui.c` **入口函数**: `app_ui()` 在 `app_ui/app_ui.c` 中 --- ## For AI/Agents ## 给 AI/Agent 的说明 If you are an AI or Agent and want to **set up or modify this project**, please refer to: 如果你是 AI 或 Agent,想要**设置或修改此项目**,请参考: > **[README_AGENT.md](./README_AGENT.md)** > > This file contains detailed configuration instructions, version requirements, and troubleshooting for AI/agents to set up the project from scratch. > > 该文件包含详细的配置说明、版本要求和故障排除,供 AI/Agent 从零配置项目。 --- ## License ## 许可证 This project uses: - LVGL 8.4 (MIT License) - lv_drivers 8.3.0 (MIT License) - SDL2 2.32.10 (zlib License) --- > **Last Updated**: 2026-08-12 > > **最后更新**: 2026-08-12