mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-23 16:57:02 +00:00
Scale mouse input deltas based on the ratio of the stream resolution to the screen size and the screen scale
This commit is contained in:
@@ -16,6 +16,17 @@
|
||||
CGPoint touchLocation;
|
||||
BOOL touchMoved;
|
||||
OnScreenControls* onScreenControls;
|
||||
|
||||
float xDeltaFactor;
|
||||
float yDeltaFactor;
|
||||
float screenFactor;
|
||||
}
|
||||
|
||||
- (void) setMouseDeltaFactors:(float)x y:(float)y {
|
||||
xDeltaFactor = x;
|
||||
yDeltaFactor = y;
|
||||
|
||||
screenFactor = [[UIScreen mainScreen] scale];
|
||||
}
|
||||
|
||||
- (void) setupOnScreenControls:(ControllerSupport*)controllerSupport {
|
||||
@@ -50,8 +61,13 @@
|
||||
if (touchLocation.x != currentLocation.x ||
|
||||
touchLocation.y != currentLocation.y)
|
||||
{
|
||||
LiSendMouseMoveEvent(currentLocation.x - touchLocation.x,
|
||||
currentLocation.y - touchLocation.y );
|
||||
int deltaX = currentLocation.x - touchLocation.x;
|
||||
int deltaY = currentLocation.y - touchLocation.y;
|
||||
|
||||
deltaX *= xDeltaFactor * screenFactor;
|
||||
deltaY *= yDeltaFactor * screenFactor;
|
||||
|
||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
||||
|
||||
touchMoved = true;
|
||||
touchLocation = currentLocation;
|
||||
|
||||
Reference in New Issue
Block a user