初级会员
- 积分
- 65
- 金钱
- 65
- 注册时间
- 2017-11-9
- 在线时间
- 9 小时
|
发表于 2020-6-22 11:06:08
|
显示全部楼层
本帖最后由 tanekliang 于 2020-6-22 11:07 编辑
不同的输入设备支持起来很容易的。lvgl支持鼠标的部分按键。
模拟器里面是通过SDL得到鼠标输入的:
- void mouse_handler(SDL_Event * event)
- {
- switch(event->type) {
- case SDL_MOUSEBUTTONUP:
- if(event->button.button == SDL_BUTTON_LEFT)
- left_button_down = false;
- break;
- case SDL_MOUSEBUTTONDOWN:
- if(event->button.button == SDL_BUTTON_LEFT) {
- left_button_down = true;
- last_x = event->motion.x / MONITOR_ZOOM;
- last_y = event->motion.y / MONITOR_ZOOM;
- }
- break;
- case SDL_MOUSEMOTION:
- last_x = event->motion.x / MONITOR_ZOOM;
- last_y = event->motion.y / MONITOR_ZOOM;
- break;
- case SDL_FINGERUP:
- left_button_down = false;
- last_x = LV_HOR_RES * event->tfinger.x / MONITOR_ZOOM;
- last_y = LV_VER_RES * event->tfinger.y / MONITOR_ZOOM;
- break;
- case SDL_FINGERDOWN:
- left_button_down = true;
- last_x = LV_HOR_RES * event->tfinger.x / MONITOR_ZOOM;
- last_y = LV_VER_RES * event->tfinger.y / MONITOR_ZOOM;
- break;
- case SDL_FINGERMOTION:
- last_x = LV_HOR_RES * event->tfinger.x / MONITOR_ZOOM;
- last_y = LV_VER_RES * event->tfinger.y / MONITOR_ZOOM;
- break;
- }
- }
复制代码
你看对应的代码就知道,它只处理了鼠标左键的事件。
如果打开了配置LV_EX_MOUSEWHEEL,就处理中键。
|
|