参考链接2: 一步一步分享在Windows QtCreator/Mingw平台编译运行调试LittleVGL
给大家介绍一个非常不错的GUI ---- littlevgl
官网地址: https://littlevgl.com
github地址: https://github.com/littlevgl/
PC模拟演示程序:
git clone https://github.com/littlevgl/pc_simulator.git
cd pc_simulator
git submodule update --init
make
./demo
离线
离线
虽然用MSVC编译有难度, 但是如果使用 mingw编译基本还是没坑的。
下面我使用Ubuntu14.04LTS的mingw,交叉出windows平台的littlevgl:
1. Ubuntu安装mingw 64位编译: sudo apt-get install mingw-w64
2. 下载SDL2源码: https://www.libsdl.org/release/SDL2-2.0.7.tar.gz
解压: tar xvf SDL2-2.0.7.tar.gz
3. 配置: ./configure --prefix=/usr/i686-w64-mingw32 --build=i686-unknown-linux-gnu --host=i686-w64-mingw32
安装: make; make install
4. 下载、更新littlevgl模拟器源码:
git clone https://github.com/littlevgl/pc_simulator.git
cd pc_simulator
git submodule update --init
make
5. 遇到一个链接错误: undefined reference to `WinMain@16'
解决办法参考: I get "Undefined reference to 'WinMain@16'"
Makefile文件添加: -lmingw32 -lSDL2main -lSDL2 -mwindows
6. 再次执行make, 编译成功,拷贝到Windows:
cp /usr/lib/gcc/i686-w64-mingw32/4.8/libgcc_s_sjlj-1.dll /mnt/hgfs/D/pc_simulator/
cp /usr/i686-w64-mingw32/bin/SDL2.dll /mnt/hgfs/D/pc_simulator/
cp demo /mnt/hgfs/D/pc_simulator/demo.exe
合影留念:
离线
int main(int argc, char *argv[])
{
/*LittlevGL init*/
lv_init();monitor_init(); //开启SDL窗口
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.disp_flush = monitor_flush;
disp_drv.disp_fill = monitor_fill;
disp_drv.disp_map = monitor_map;
lv_disp_drv_register(&disp_drv);/*Create a "Hello world!" label*/
lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label, "Hello world!WWWMMM");
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);/*Handle LitlevGL tasks (tickless mode)*/
while(1) {
lv_tick_inc(5);
lv_task_handler();
usleep(5000);
}return 0;
}
一个非常简单的字符显示程序,字体挺好看,自带抗锯齿效果。
参考: embedded-gui-using-linux-frame-buffer-device-with-littlevgl
离线
lv_conf.h
#define LV_HOR_RES 800
#define LV_VER_RES (480)
#define USE_LV_THEME_ALIEN 1
V3s Linux 4.13-y 跑 littlevgl成功!
参考链接:embedded-gui-using-linux-frame-buffer-device-with-littlevgl
离线
离线