LittleVGL Visual Studio 模拟器的使用

一. LVGL模拟器是什么?

就是可以在PC跑LVGL,不依赖于任何嵌入式设备(STM32/树莓派/.....等等等等)

可以支持以下IDE(可点击进入LVGL不同模拟器仓库)

The simulator is ported to various IDEs (Integrated Development Environments). Choose your favorite IDE, read its README on GitHub, download the project, and load it to the IDE.

  • Eclipse with SDL driver: Recommended on Linux and Mac

  • CodeBlocks: Recommended on Windows

  • VisualStudio with SDL driver: For Windows

  • VSCode with SDL driver: Recommended on Linux and Mac

  • PlatformIO with SDL driver: Recommended on Linux and Mac

You can use any IDEs for the development but, for simplicity, the configuration for Eclipse CDT is focused in this tutorial. The following section describes the set-up guide of Eclipse CDT in more details.

Note: If you are on Windows, it's usually better to use the Visual Studio or CodeBlocks projects instead. They work out of the box without requiring extra steps.

二. LVGL模拟器有什么优势?

官方(https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html?highlight=visual%20studio#select-an-ide)说的很明白:

Simulator on the PC have the following advantages:

  • Hardware independent - Write a code, run it on the PC and see the result on the PC monitor.

  • Cross-platform - Any Windows, Linux or OSX PC can run the PC simulator.

  • Portability - the written code is portable, which means you can simply copy it when using an embedded hardware.

  • Easy Validation - The simulator is also very useful to report bugs because it means common platform for every user. So it's a good idea to reproduce a bug in simulator and use the code snippet in the Forum.

三. 怎样在Visual Studio跑起来LVGL

1.前提条件:

1) 电脑安装了git

2) 电脑安装了VS2019(Github仓库说强烈建议2019,但是他说2017也可以,But,我自己试过2017有变异错误,懒得去查为啥了,所以直接安装2019吧)

2. 使用步骤:

步骤一:敲以下命令(把仓库的code clone下来,由于有自仓库,所以还不能直接在github download code.zip)

git clone --recurse-submodules https://github.com/lvgl/lv_sim_visual_studio.git

步骤二:  使用工程,此部分有两个工程,一个是SDL,一个是基于Win32的,我们来分别说下

1. 使用SDL工程

打开lv_sim_visual_studio\lv_sim下的lv_sim_visual_studio_sdl.sln工程

打开后有一个注意的点:要把平台根据你的电脑是32bit还是64bit设置为x86或者x64,我是64bit的,所以设置为x64

然后就可以直接运行了,效果如下:

LittleVGL Visual Studio 模拟器的使用_第1张图片

2. 使用Win32工程

打开Llv_sim_visual_studio下的LVGL.sln工程

打开后有两个注意的点:

1)要把平台根据你的电脑是32bit还是64bit设置为x86或者x64,我是64bit的,所以设置为x64

2)设置启动项为如下,否则运行运行不了

LittleVGL Visual Studio 模拟器的使用_第2张图片

然后就啥代码也不用改,就直接可以运行起来啦,效果图

LittleVGL Visual Studio 模拟器的使用_第3张图片

你可能感兴趣的:(#,LVGL,GUI,LVGL模拟器,LVGL,LVGL,VS)