Keyboard + Mouse input handling; some cleanups
* Keyboard input: KeyboardInput.m - Requires iOS 13.4. Used pressesBegan and pressesEnded. - Not all keys are handled, these will be handled later. * Mouse input - Requires iOS 13.0 for hovering. Used UIHoverGestureRecognizer. - Requires iOS 14.0 for L/R mouse buttons and scroll handling. Used GCMouse for now. We will use iOS 13.4(?)'s API later. - Pointer lock is not yet handled. These above apply to iPadOS aswell, not sure about tvOS. iPhone users need to disable "Perform Touch Gestures" in the AssistiveTouch Accessibility settings in order to get the pointer hovering to work. * Cleanups - Use asprintf instead of sprintf when possible - CallbackBridge functions: removed unnecessary JNI fields. - Condition cleanup (managing virtual mouse position).
This commit is contained in:
1 parent
8624e54630
commit
b6f552df85
11 files changed
+394
-197
No files matched your search
@@ -177,8 +177,6 @@ public final class Tools
|
||||
if (versionInfo.inheritsFrom != null) {
|
||||
versionName = versionInfo.inheritsFrom;
|
||||
}
|
||||
|
||||
String userType = "mojang";
|
||||
|
||||
File gameDir = new File(Tools.DIR_GAME_NEW);
|
||||
gameDir.mkdirs();
|
||||
@@ -194,7 +192,7 @@ public final class Tools
|
||||
varArgMap.put("game_assets", Tools.ASSETS_PATH);
|
||||
varArgMap.put("game_directory", gameDir.getAbsolutePath());
|
||||
varArgMap.put("user_properties", "{}");
|
||||
varArgMap.put("user_type", userType);
|
||||
varArgMap.put("user_type", /* profile.isMicrosoft ? "msa" : */ "mojang"); // FIXME: handle MS auth
|
||||
varArgMap.put("version_name", versionName);
|
||||
varArgMap.put("version_type", versionInfo.type);
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ public class UIKit {
|
||||
public static final int ACTION_DOWN = 0;
|
||||
public static final int ACTION_UP = 1;
|
||||
public static final int ACTION_MOVE = 2;
|
||||
|
||||
public static final int ACTION_MOVE_MOTION = 3;
|
||||
|
||||
private static int guiScale;
|
||||
|
||||
private static void patch_FlatLAF_setLinux() {
|
||||
@@ -123,6 +124,10 @@ public class UIKit {
|
||||
CallbackBridge.mouseY = y;
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_MOVE_MOTION:
|
||||
CallbackBridge.mouseX += x;
|
||||
CallbackBridge.mouseY += y;
|
||||
}
|
||||
CallbackBridge.mouseLastX = x;
|
||||
CallbackBridge.mouseLastY = y;
|
||||
|
||||
Reference in new issue
Block a user