[Scummvm-git-logs] scummvm master -> eb49ef0626bc007d0cc37957510414a566c9d032
rsn8887
rsn8887 at users.noreply.github.com
Sun Jul 15 18:02:44 CEST 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
eb49ef0626 PSP2: Improve pointer response to slow finger motion
Commit: eb49ef0626bc007d0cc37957510414a566c9d032
https://github.com/scummvm/scummvm/commit/eb49ef0626bc007d0cc37957510414a566c9d032
Author: rsn8887 (rsn8887 at users.noreply.github.com)
Date: 2018-07-15T03:30:42-05:00
Commit Message:
PSP2: Improve pointer response to slow finger motion
Changed paths:
backends/events/psp2sdl/psp2sdl-events.cpp
backends/events/psp2sdl/psp2sdl-events.h
diff --git a/backends/events/psp2sdl/psp2sdl-events.cpp b/backends/events/psp2sdl/psp2sdl-events.cpp
index a342fa8..4095678 100644
--- a/backends/events/psp2sdl/psp2sdl-events.cpp
+++ b/backends/events/psp2sdl/psp2sdl-events.cpp
@@ -50,6 +50,9 @@ PSP2EventSource::PSP2EventSource() {
_simulatedClickStartTime[port][i] = 0;
}
}
+
+ _hiresDX = 0;
+ _hiresDY = 0;
}
bool PSP2EventSource::pollEvent(Common::Event &event) {
@@ -260,11 +263,15 @@ void PSP2EventSource::preprocessFingerMotion(SDL_Event *event) {
}
// convert touch events to relative mouse pointer events
- // Whenever an SDL_event involving the mouse is processed,
- // _km.x/y are truncated from subpixel precision to regular pixel precision.
- // Therefore, there's no need here to deal with subpixel precision in _km.x/y.
- x = (_km.x / MULTIPLIER + (event->tfinger.dx * 1.25 * speedFactor * _km.x_max));
- y = (_km.y / MULTIPLIER + (event->tfinger.dy * 1.25 * speedFactor * _km.y_max));
+ // track sub-pixel relative finger motion using the MULTIPLIER
+ _hiresDX += (event->tfinger.dx * 1.25 * speedFactor * _km.x_max * MULTIPLIER);
+ _hiresDY += (event->tfinger.dy * 1.25 * speedFactor * _km.y_max * MULTIPLIER);
+ int xRel = _hiresDX / MULTIPLIER;
+ int yRel = _hiresDY / MULTIPLIER;
+ x = (_km.x / MULTIPLIER) + xRel;
+ y = (_km.y / MULTIPLIER) + yRel;
+ _hiresDX %= MULTIPLIER;
+ _hiresDY %= MULTIPLIER;
}
if (x > _km.x_max) {
diff --git a/backends/events/psp2sdl/psp2sdl-events.h b/backends/events/psp2sdl/psp2sdl-events.h
index 1d5fdf9..f37d51c 100644
--- a/backends/events/psp2sdl/psp2sdl-events.h
+++ b/backends/events/psp2sdl/psp2sdl-events.h
@@ -65,6 +65,9 @@ private:
unsigned int _simulatedClickStartTime[SCE_TOUCH_PORT_MAX_NUM][2]; // initiation time of last simulated left or right click (zero if no click)
+ int _hiresDX; // keep track of slow, sub-pixel, finger motion across multiple frames
+ int _hiresDY;
+
void preprocessFingerDown(SDL_Event *event);
void preprocessFingerUp(SDL_Event *event);
void preprocessFingerMotion(SDL_Event *event);
More information about the Scummvm-git-logs
mailing list