How to display mouse arrows on the screen?

Hello,

When touching the screen, I want the mouse arrow to track the current touch position display. How to achieve it?

Something like this. You have to create a cursor first and a callback for the mouse

lv_indev_drv_init(&indev_drv_mouse);|

indev_drv_mouse.type = LV_INDEV_TYPE_POINTER;
indev_drv_mouse.read_cb = mouse_read;
indev_mouse = lv_indev_drv_register(&indev_drv_mouse);
//Set cursor. For simplicity set a HOME symbol now.
lv_obj_t *mouse_cursor = lv_img_create(lv_scr_act());
lv_img_set_src(mouse_cursor, &mouse_cursor_icon);
lv_indev_set_cursor(indev_mouse, mouse_cursor);

1 Like

I am using a touch screen without a mouse. Are you sure this is okay?

https://docs.lvgl.io/master/porting/indev.html#touchpad-mouse-or-any-pointer

1 Like

This is how I do i’t also touch and mouse

Ok,it works!
Thank you paul!