Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL: Always use sub-pixel joystick pointer #914

Merged
merged 1 commit into from Mar 4, 2017
Merged

Conversation

rsn8887
Copy link
Contributor

@rsn8887 rsn8887 commented Mar 1, 2017

With the new joystick pointer speed adjustment in the SDL backend which can be less then one pixel per frame delay, all calls to
ProcessMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER)
with those exact second and third arguments need to be prevented from updating _km.x and _km.y since that will destroy the sub-pixel resolution and make the joystick pointer control less precise. But calls to ProcessMouseEvent with other arguments should still update _km.x and _km.y.

Before this PR, the call to ProcessMouseEvent inside handleKbdMouse was made to work correctly by first saving and, after the call, re-loading the hi-res _km.x and _km.y coordinate values. But all the other calls still exhibit the problem of overwriting _km.x and _km.y with imprecise numbers.

To fix this, in this PR, I removed the update of _km.x and _km.y from the processMouseEvent routine, and instead added explicit _km updates to the sources where they are needed. Since most calls to ProcessMouseEvent are in the form ProcessMouseEvent(_km.x / MULTIPLIER, _km.y / MULTIPLIER) this did not require many changes, and I think the result is (IMO) in clearer code since processMouseEvent does not have this side-effect of changing _km.x and _km.y anymore.

@sev-
Copy link
Member

sev- commented Mar 4, 2017

OK, thanks, merging.

@sev- sev- merged commit 9fcb56f into scummvm:master Mar 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants