-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Open
Description
Hello,
I'm not sure if this is the right place to post, I'm trying to modify the imgui_impl_sdl.cpp file to add touchscreen support on a raspberry pi. I've added SDL touch events to the event loop and it seems to process them similarly to mouse event. The programs isn't responding to them the same way and I'm not sure why. The following was added to the event->type loop.
SDL_DisplayMode DM;
SDL_GetCurrentDisplayMode(0, &DM);
case SDL_FINGERDOWN:
case SDL_FINGERUP:
{
int mouse_button = 0; // left click
io.AddMouseButtonEvent(mouse_button, (event->type == SDL_MOUSEBUTTONDOWN));
bd->MouseButtonsDown = (event->type == SDL_MOUSEBUTTONDOWN) ? (bd->MouseButtonsDown | (1 << mouse_button)) : (bd->MouseButtonsDown & ~(1 << mouse_button));
printf("Finger Up\n");
return true;
}
case SDL_FINGERMOTION:
{
int disp_x = (int)(DM.w * (float)event->tfinger.x);
int disp_y = (int)(DM.h * (float)event->tfinger.y);
printf("Finger Motion %d %d\n", disp_x, disp_y);
io.AddMousePosEvent(disp_x, disp_y);
return true;
}
The touch events occur like I would expect them to, however imgui doesn't seem to be responding to the "click" events. The most I can get to occur is it will act like the mouse is hovering over a control in the demo. I feel like I'm missing something with how imgui works.
Thank you