We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1506 - Changing orientation on the devices throws off touch scaling
Summary: Changing orientation on the devices throws off touch scaling
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All Android (All)
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks: 1603
  Show dependency treegraph
 
Reported: 2012-05-25 16:30 UTC by Gabriel Jacobo
Modified: 2012-09-20 07:11 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Jacobo 2012-05-25 16:30:29 UTC
The problem is simple enough, if you look at Android_OnTouch it creates a Touch device if none exist, and it scales the touches using Android_ScreenWidth/Android_ScreenHeight.

However, if you turn the device around, these values will of course change, but the scaling remains the same...so the touches are wrongly scaled.

It's an interesting hurdle what to do to solve it.

We can do a hacky thing and for every touch get the touch device pointer (which we already do) and update x_max and y_max blindly...or we can be a more elaborate and only update if x_max != Android_ScreenWidth for example.

I think the best would be to remove all touch devices when the screen size changes, the question is how... (SDL_TouchQuit ?)
Comment 1 Gabriel Jacobo 2012-08-24 09:11:29 UTC
Fixed http://hg.libsdl.org/SDL/rev/2ed5671bc5e0