mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
New option: treat back button as right mouse
Some Android devices treats right mouse input as back button, so enable to convert back to right mouse.
This commit is contained in:
parent
8f21e9d5f5
commit
f4412eb232
@ -5,6 +5,8 @@ import android.view.*;
|
||||
|
||||
import java.net.CookieHandler;
|
||||
import java.util.*;
|
||||
|
||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
public class AndroidLWJGLKeycode {
|
||||
@ -173,12 +175,16 @@ public class AndroidLWJGLKeycode {
|
||||
|
||||
try {
|
||||
//System.out.println(((int)keyEvent.getDisplayLabel()) + " " +keyEvent.getDisplayLabel());
|
||||
if(keyEvent.getUnicodeChar() != 0) {
|
||||
char key = (char)keyEvent.getUnicodeChar();
|
||||
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && LauncherPreferences.PREF_BACK_TO_RIGHT_MOUSE) {
|
||||
BaseMainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, keyEvent.getAction() == KeyEvent.ACTION_DOWN);
|
||||
} else {
|
||||
if(keyEvent.getUnicodeChar() != 0) {
|
||||
char key = (char)keyEvent.getUnicodeChar();
|
||||
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()),key,0,CallbackBridge.getCurrentMods(),keyEvent.getAction() == KeyEvent.ACTION_DOWN);
|
||||
}else{
|
||||
}else{
|
||||
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()),CallbackBridge.getCurrentMods(),keyEvent.getAction()==KeyEvent.ACTION_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ public class LauncherPreferences
|
||||
public static boolean PREF_FREEFORM = false;
|
||||
public static boolean PREF_HIDE_SIDEBAR = false;
|
||||
public static boolean PREF_IGNORE_NOTCH = false;
|
||||
public static boolean PREF_BACK_TO_RIGHT_MOUSE = false;
|
||||
public static int PREF_NOTCH_SIZE = 0;
|
||||
public static float PREF_BUTTONSIZE = 100f;
|
||||
public static float PREF_MOUSESCALE = 100f;
|
||||
@ -28,6 +29,7 @@ public class LauncherPreferences
|
||||
PREF_FREEFORM = DEFAULT_PREF.getBoolean("freeform", false);
|
||||
PREF_HIDE_SIDEBAR = DEFAULT_PREF.getBoolean("hideSidebar", false);
|
||||
PREF_IGNORE_NOTCH = DEFAULT_PREF.getBoolean("ignoreNotch", false);
|
||||
PREF_BACK_TO_RIGHT_MOUSE = DEFAULT_PREF.getBoolean("backToRightMouse", true);
|
||||
PREF_VERTYPE_RELEASE = DEFAULT_PREF.getBoolean("vertype_release", true);
|
||||
PREF_VERTYPE_SNAPSHOT = DEFAULT_PREF.getBoolean("vertype_snapshot", false);
|
||||
PREF_VERTYPE_OLDALPHA = DEFAULT_PREF.getBoolean("vertype_oldalpha", false);
|
||||
|
@ -85,6 +85,8 @@
|
||||
<string name="mcl_setting_subtitle_resolution_scaler">Allows you to decrease the game resolution. 100% is full resolution</string>
|
||||
<string name="mcl_setting_title_longpresstrigger">How long will trigger after long press</string>
|
||||
<string name="mcl_setting_subtitle_longpresstrigger">Change trigger time for long press in destroy block and drop item.</string>
|
||||
<string name="mcl_setting_title_backtorightmouse">Treat back button as right mouse</string>
|
||||
<string name="mcl_setting_subtitle_backtorightmouse">Some devices treats external right mouse as back button. If you are using external mouse, you should enable this.</string>
|
||||
<string name="mcl_setting_title_buttonscale">Control buttons scaling</string>
|
||||
<string name="mcl_setting_subtitle_buttonscale">Upscale them if buttons are too small.</string>
|
||||
<string name="mcl_setting_title_mousescale">Mouse scaling</string>
|
||||
|
@ -49,6 +49,11 @@
|
||||
android:key="autoRam"
|
||||
android:summary="@string/auto_ram_subtitle"
|
||||
android:title="@string/auto_ram_title" />
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="backToRightMouse"
|
||||
android:summary="@string/mcl_setting_subtitle_backtorightmouse"
|
||||
android:title="@string/mcl_setting_title_backtorightmouse" />
|
||||
|
||||
<androidx.preference.EditTextPreference
|
||||
android:dialogTitle="@string/mcl_setting_title_javaargs"
|
||||
|
Loading…
x
Reference in New Issue
Block a user