Broken touch positions with SDL_RenderSetLogicalSize & H |
Eric Wing
Guest
|
Hi, I think I found a bug when using SDL_WINDOW_ALLOW_HIGHDPI with
SDL_RenderSetLogicalSize on iOS. I use SDL_RenderSetLogicalSize for all my stuff. I just tried turning on SDL_WINDOW_ALLOW_HIGHDPI on iOS and suddenly all my touch/mouse positions are really broken/far-off-the-mark. I actually don't have a real retina device (still) so I'm seeing this using the iOS simulator with a 6plus template. Attached is a simple test program that can reproduce the problem. It uses RenderSetLogicalSize and draws some moving happy faces (to show the boundaries/space of the LogicalSize and that it is working correctly for that part). When you click/touch, it will draw one more happy face where your button point is. If you comment out SDL_WINDOW_ALLOW_HIGHDPI, everything works as expected. But if you compile with it in, the mouse coordinates seem really far off the mark. (Face appears far up and to the left.) I'm wondering if anybody has encountered this, knows more about it (maybe it is caused by something else), or knows how to fix it. Thanks, Eric _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
Broken touch positions with SDL_RenderSetLogicalSize & H |
Alex Szpakowski
Guest
|
I believe this is a bug in SDL_Render’s platform-agnostic mouse coordinate scaling code. It assumes the units of the mouse coordinates are always in pixels, which isn’t the case where high-DPI is involved (regardless of whether iOS is used) – they’re actually in “DPI independent†coordinates (which matches the window size, but not the renderer output size).
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Broken touch positions with SDL_RenderSetLogicalSize & H |
Eric Wing
Guest
|
On 4/20/16, Alex Szpakowski wrote:
Do you know if Mac is affected by this problem too? (I don't have a retina Mac either.) Thanks, Eric _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Broken touch positions with SDL_RenderSetLogicalSize & H |
Alex Szpakowski
Guest
|
If my hypothesis is correct, then yes (as well as any other platform SDL adds high-dpi support for in the future).
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Broken touch positions with SDL_RenderSetLogicalSize & H |
Eric Wing
Guest
|
On 4/20/16, Alex Szpakowski wrote:
Okay, I just filed a bug so this isn't lost. https://bugzilla.libsdl.org/show_bug.cgi?id=3311 Thanks, Eric _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
Broken touch positions with SDL_RenderSetLogicalSize & H |
hardcoredaniel
Guest
|
I can confirm the "problem", too, on iOS, but I always assumed that it is intentional. From my memory (probably not correct terms I'm using) I understood that the SDL window is in points, and so will be all touch and mouse coordinates. If you specify HIGHDPI, then you need to query the renderer for the pixel resolution to check whether there's a mismatch to the "points". It was unexpected for me to handle touch events in a different coordinate system than to handle rendering, but it looks like SDL is consistent in that separation (at least at the moment).
---------- Původnà zpráva ---------- Od: Eric Wing Komu: SDL Development List Datum: 21. 4. 2016 2:50:59 Předmět: Re: [SDL] Broken touch positions with SDL_RenderSetLogicalSize & HIGHDPI on iOS
|
|||||||||||||||||
|