https://github.com/littlevgl/visual_studio_2017_sdl_x64
操作方法:
git clone --recursive https://github.com/littlevgl/visual_studio_2017_sdl_x64.git
debugdump@DESKTOP-32PC8B1 MINGW64 /d/Work
$ git clone --recursive https://github.com/littlevgl/visual_studio_2017_sdl_x64.git
Cloning into 'visual_studio_2017_sdl_x64'...
remote: Enumerating objects: 132, done.
remote: Counting objects: 100% (132/132), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 132 (delta 20), reused 127 (delta 19), pack-reused 0
Receiving objects: 100% (132/132), 413.12 KiB | 451.00 KiB/s, done.
Resolving deltas: 100% (20/20), done.
Submodule 'visual_studio_2017_sdl/lv_drivers' (https://github.com/littlevgl/lv_drivers.git) registered for path 'visual_studio_2017_sdl/lv_drivers'
Submodule 'visual_studio_2017_sdl/lv_examples' (https://github.com/littlevgl/lv_examples.git) registered for path 'visual_studio_2017_sdl/lv_examples'
Submodule 'visual_studio_2017_sdl/lvgl' (https://github.com/littlevgl/lvgl.git) registered for path 'visual_studio_2017_sdl/lvgl'
Cloning into 'D:/Work/visual_studio_2017_sdl_x64/visual_studio_2017_sdl/lv_drivers'...
remote: Enumerating objects: 32, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 800 (delta 15), reused 21 (delta 9), pack-reused 768
Receiving objects: 100% (800/800), 211.05 KiB | 90.00 KiB/s, done.
Resolving deltas: 100% (548/548), done.
Cloning into 'D:/Work/visual_studio_2017_sdl_x64/visual_studio_2017_sdl/lv_examples'...
remote: Enumerating objects: 257, done.
remote: Counting objects: 100% (257/257), done.
remote: Compressing objects: 100% (186/186), done.
remote: Total 2770 (delta 149), reused 128 (delta 71), pack-reused 2513
Receiving objects: 100% (2770/2770), 5.24 MiB | 37.00 KiB/s, done.
Resolving deltas: 100% (1856/1856), done.
Cloning into 'D:/Work/visual_studio_2017_sdl_x64/visual_studio_2017_sdl/lvgl'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 12322 (delta 5), reused 13 (delta 4), pack-reused 12304
Receiving objects: 100% (12322/12322), 10.56 MiB | 34.00 KiB/s, done.
Resolving deltas: 100% (9723/9723), done.
Submodule path 'visual_studio_2017_sdl/lv_drivers': checked out 'ea1bfc91dca58e5a2bc5c75ef48ed15db370e518'
Submodule path 'visual_studio_2017_sdl/lv_examples': checked out 'f3a14a9c3cf7f097a0f2bf0a2e8060dc0994dddb'
Submodule path 'visual_studio_2017_sdl/lvgl': checked out 'da01b4dd319fec72662ca0f27c4302baf1e651bc'
离线
1. 克隆项目:
git clone --recursive https://github.com/littlevgl/visual_studio_2017_sdl_x64.git
2. 下载 libsdl库并解压:
下载 https://www.libsdl.org/release/SDL2-devel-2.0.9-VC.zip
解压后把 SDL2-2.0.9\lib\x64\* 文件拷贝到工程 visual_studio_2017_sdl_x64\visual_studio_2017_sdl\SDL2\lib 目录
3. 下载 sdl 动态链接库:
下载 https://www.libsdl.org/release/SDL2-2.0.9-win32-x64.zip 的 SDL2.dll 拷贝到 main.c 同一个目录
接着编译运行, 非常顺利!
清理重新来过, VC2017 10秒编译完了, mingw 10分钟都编译不完.
离线
为了方便对git不熟的朋友, 这里提供打包下载, SDL 的 lib 和 dll 已经内置, 可以用 VC2015/VC2017 编译成功:
本站下载: visual_studio_2017_sdl_x64_debugdump_20190116.7z
只需要设置 目标平台 和 平台工具集
离线
lv_res_t click(struct _lv_obj_t * obj)
{
printf("click \n");
}
lv_res_t long_click(struct _lv_obj_t * obj)
{
printf("long click \n");
}
lv_res_t press(struct _lv_obj_t * obj)
{
printf("press \n");
}
lv_res_t long_press_repeat(struct _lv_obj_t * obj)
{
printf("long press repeat \n");
}
/**
* Create a demo application
*/
void demo_create(void)
{
lv_obj_t* object = lv_btn_create(lv_scr_act(), NULL);
lv_btn_set_action(object, LV_BTN_ACTION_CLICK, click);
lv_btn_set_action(object, LV_BTN_ACTION_PR, press);
lv_btn_set_action(object, LV_BTN_ACTION_LONG_PR, long_click);
lv_btn_set_action(object, LV_BTN_ACTION_LONG_PR_REPEAT, long_press_repeat);
......
}
对比 littlevgl 的编程接口, 比起 ucgui / emwin, 简直太优秀了!
按压(press), 按下(click), 长按(long press), 反复长按(long press repeat) 都有相应的事件。
离线