IOS7: Implement support for setting mouse pointer speed

Implement support to set the mouse pointer speed in settings.
The mouse pointer speed is applied to both mouse input and touch
input when in touchpad-mode.
This commit is contained in:
Lars Sundström 2023-03-12 08:21:04 +01:00
parent 72518221d8
commit d397938107
3 changed files with 29 additions and 4 deletions

View File

@ -295,8 +295,8 @@ bool OSystem_iOS7::handleEvent_touchFirstDragged(Common::Event &event, int x, in
_lastPadX = x;
_lastPadY = y;
mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
mouseNewPosX = (int)(_videoContext->mouseX - (int)((float)deltaX * getMouseSpeed()));
mouseNewPosY = (int)(_videoContext->mouseY - (int)((float)deltaY * getMouseSpeed()));
int widthCap = _videoContext->overlayInGUI ? _videoContext->overlayWidth : _videoContext->screenWidth;
int heightCap = _videoContext->overlayInGUI ? _videoContext->overlayHeight : _videoContext->screenHeight;
@ -353,8 +353,8 @@ void OSystem_iOS7::handleEvent_mouseRightButtonUp(Common::Event &event, int x, i
}
void OSystem_iOS7::handleEvent_mouseDelta(Common::Event &event, int deltaX, int deltaY) {
int mouseNewPosX = (int)(_videoContext->mouseX - deltaX);
int mouseNewPosY = (int)(_videoContext->mouseY - deltaY);
int mouseNewPosX = (int)(_videoContext->mouseX - (int)((float)deltaX * getMouseSpeed()));
int mouseNewPosY = (int)(_videoContext->mouseY - (int)((float)deltaY * getMouseSpeed()));
int widthCap = _videoContext->overlayInGUI ? _videoContext->overlayWidth : _videoContext->screenWidth;
int heightCap = _videoContext->overlayInGUI ? _videoContext->overlayHeight : _videoContext->screenHeight;

View File

@ -162,6 +162,7 @@ bool OSystem_iOS7::hasFeature(Feature f) {
#endif
case kFeatureOpenUrl:
case kFeatureNoQuit:
case kFeatureKbdMouseSpeed:
return true;
default:
@ -301,6 +302,29 @@ void OSystem_iOS7::delayMillis(uint msecs) {
usleep(msecs * 1000);
}
float OSystem_iOS7::getMouseSpeed() {
switch (ConfMan.getInt("kbdmouse_speed")) {
case 0:
return 0.25;
case 1:
return 0.5;
case 2:
return 0.75;
case 3:
return 1.0;
case 4:
return 1.25;
case 5:
return 1.5;
case 6:
return 1.75;
case 7:
return 2.0;
default:
return 1.0;
}
}
void OSystem_iOS7::setTimerCallback(TimerProc callback, int interval) {
//printf("setTimerCallback()\n");
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

View File

@ -259,6 +259,7 @@ protected:
void handleEvent_mouseDelta(Common::Event &event, int deltaX, int deltaY);
void rebuildSurface();
float getMouseSpeed();
};
#endif