summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 16:47:05 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 16:47:05 +0300
commit992e3d00aa407d0d1d481051e2504bc56395dfb8 (patch)
tree5961b052b2c20daf10f2c35c2c6f37656b64659e /src/ui/window.c
parentd41d2e4f68ac990cff543f5e5cffa098714e0de7 (diff)
Mobile: Fixed invalid touch positions
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 05db9a80..cf611e31 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -2110,12 +2110,19 @@ iInt2 coord_Window(const iWindow *d, int x, int y) {
2110} 2110}
2111 2111
2112iInt2 mouseCoord_Window(const iWindow *d) { 2112iInt2 mouseCoord_Window(const iWindow *d) {
2113#if defined (iPlatformMobile)
2114 /* At least on iOS the coordinates returned by SDL_GetMouseState() do no match up with
2115 our touch coordinates on the Y axis (?). Maybe a pixel ratio thing? */
2116 iUnused(d);
2117 return latestPosition_Touch();
2118#else
2113 if (!d->isMouseInside) { 2119 if (!d->isMouseInside) {
2114 return init_I2(-1000000, -1000000); 2120 return init_I2(-1000000, -1000000);
2115 } 2121 }
2116 int x, y; 2122 int x, y;
2117 SDL_GetMouseState(&x, &y); 2123 SDL_GetMouseState(&x, &y);
2118 return coord_Window(d, x, y); 2124 return coord_Window(d, x, y);
2125#endif
2119} 2126}
2120 2127
2121float uiScale_Window(const iWindow *d) { 2128float uiScale_Window(const iWindow *d) {