From 62ea92335dcd8e5b9a41764934a0984425ef1b65 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 26 Oct 2015 23:59:53 -0700 Subject: [PATCH] Use a reference resolution rather than the actual stream resolution when scaling mouse movement --- app/src/main/java/com/limelight/Game.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 1837563b..b8ecae06 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -1,7 +1,6 @@ package com.limelight; -import com.limelight.LimelightBuildProps; import com.limelight.binding.PlatformBinding; import com.limelight.binding.input.ControllerHandler; import com.limelight.binding.input.KeyboardTranslator; @@ -64,6 +63,9 @@ public class Game extends Activity implements SurfaceHolder.Callback, private final TouchContext[] touchContextMap = new TouchContext[2]; private long threeFingerDownTime = 0; + private static final double REFERENCE_HORIZ_RES = 1280; + private static final double REFERENCE_VERT_RES = 720; + private static final int THREE_FINGER_TAP_THRESHOLD = 300; private ControllerHandler controllerHandler; @@ -219,8 +221,8 @@ public class Game extends Activity implements SurfaceHolder.Callback, // Initialize touch contexts for (int i = 0; i < touchContextMap.length; i++) { touchContextMap[i] = new TouchContext(conn, i, - ((double)prefConfig.width / (double)screenSize.x), - ((double)prefConfig.height / (double)screenSize.y)); + (REFERENCE_HORIZ_RES / (double)screenSize.x), + (REFERENCE_VERT_RES / (double)screenSize.y)); } if (LimelightBuildProps.ROOT_BUILD) { @@ -684,8 +686,8 @@ public class Game extends Activity implements SurfaceHolder.Callback, // Scale the deltas if the device resolution is different // than the stream resolution - deltaX = (int)Math.round((double)deltaX * ((double)prefConfig.width / (double)screenSize.x)); - deltaY = (int)Math.round((double)deltaY * ((double)prefConfig.height / (double)screenSize.y)); + deltaX = (int)Math.round((double)deltaX * (REFERENCE_HORIZ_RES / (double)screenSize.x)); + deltaY = (int)Math.round((double)deltaY * (REFERENCE_VERT_RES / (double)screenSize.y)); conn.sendMouseMove((short)deltaX, (short)deltaY); }