| Summary: | mouse & touch coordinates being distorted by SDL_RenderSetScale | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Anthony @ POW Games <ant> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.9 | ||
| Hardware: | All | ||
| OS: | Android (All) | ||
|
Description
Anthony @ POW Games
2019-04-24 01:39:58 UTC
Deffo a bug. Nothing should be producing touch events above the range of 1.0f, or mouse coordinates larger than the window size. Why should setting logical scale affect coordinates on Android but not Win10? You're completely correct in your diagnosis. Normally mouse and touch events are scaled so they are in the coordinate space of the logical viewport. On Windows events come in synchronously with your event loop, but on Android they come in asynchronously. I can add a hint to disable the scaling behavior, would that help? My diagnosis was correct? I'm getting good at this, lol! I'm still confused though: if mouse coordinates are supposed to be always scaled relative to the window (I assume the window's pixel size?), and touch coordinates always 0.0f to 1.0f, what would the hint do? Why would logical scale influence these coordinates? Logical scale affects 2D drawing coordinates, where user input comes in through pixel coordinates, bypassing logical scaling surely? I managed to get around this problem by changing the order in which I change the logical scaling per frame. But since SDL_HINT_MOUSE_RELATIVE_SCALING (thanks Sam) was added, this shouldn't cause a problem in any other situation. |