You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Your SDL_FINGERDOWN/SDL_FINGERUP code is using SDL_MOUSEBUTTONDOWN when it should be SDL_FINGERDOWN. As a result you're only ever sending mouse release events to Dear ImGui.
If you run into further issues you may find it helpful to look at the IO log. You can access it via the demo window (Tools > Metrics / Debugger and then Tools > Show Debug Log) or by calling ImGui::ShowDebugLogWindow directly. From there just check the IO box and you should see input events come streaming in.
Thank you I appreciate the input, can't believe I missed that. I can move windows around now but can't interact with the controls. I'll check out the logging window and see if it provides some clues.
@stash763 Have you got around to investigate this further?
I am surprised that touch events are not emitting Mouse events. On Windows with SDL2 it does that.
I am tempted to say it would be more correct if SDL behave the same on RaspberryPi as on other systems.
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.
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
The text was updated successfully, but these errors were encountered: