mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 17:15:40 -04:00
Merge commit 'ee14e180bcd0e35d9407eb535a54511e9e3e0958'
Conflicts solved: app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/BaseMainActivity.java
This commit is contained in:
commit
1a7a710121
@ -135,8 +135,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
isInputStackCall = mVersionInfo.arguments != null;
|
||||
|
||||
this.displayMetrics = Tools.getDisplayMetrics(this);
|
||||
CallbackBridge.windowWidth = (int) ((float)displayMetrics.widthPixels / scaleFactor);
|
||||
CallbackBridge.windowHeight = (int) ((float)displayMetrics.heightPixels / scaleFactor);
|
||||
CallbackBridge.windowWidth = (int) ((float)displayMetrics.widthPixels * scaleFactor);
|
||||
CallbackBridge.windowHeight = (int) ((float)displayMetrics.heightPixels * scaleFactor);
|
||||
System.out.println("WidthHeight: " + CallbackBridge.windowWidth + ":" + CallbackBridge.windowHeight);
|
||||
|
||||
|
||||
@ -293,7 +293,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
if (gestureDetector.onTouchEvent(event)) {
|
||||
|
||||
CallbackBridge.sendCursorPos((int) (mouseX / scaleFactor), (int) (mouseY /scaleFactor));
|
||||
CallbackBridge.sendCursorPos((int) (mouseX * scaleFactor), (int) (mouseY *scaleFactor));
|
||||
CallbackBridge.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT);
|
||||
if (!rightOverride) {
|
||||
CallbackBridge.mouseLeft = true;
|
||||
@ -313,7 +313,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
mouseY = Math.max(0, Math.min(displayMetrics.heightPixels, mouseY + y - prevY));
|
||||
placeMouseAt(mouseX, mouseY);
|
||||
|
||||
CallbackBridge.sendCursorPos((int) (mouseX / scaleFactor), (int) (mouseY /scaleFactor));
|
||||
CallbackBridge.sendCursorPos((int) (mouseX * scaleFactor), (int) (mouseY *scaleFactor));
|
||||
/*
|
||||
if (!CallbackBridge.isGrabbing()) {
|
||||
CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, 0, isLeftMouseDown);
|
||||
@ -353,8 +353,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
if (mptrIndex != -1) {
|
||||
//handle mouse events by just sending the coords of the new point in touch event
|
||||
int x = (int) (e.getX(mptrIndex) / scaleFactor);
|
||||
int y = (int) (e.getY(mptrIndex) / scaleFactor);
|
||||
int x = (int) (e.getX(mptrIndex) * scaleFactor);
|
||||
int y = (int) (e.getY(mptrIndex) * scaleFactor);
|
||||
CallbackBridge.mouseX = x;
|
||||
CallbackBridge.mouseY = y;
|
||||
CallbackBridge.sendCursorPos(x, y);
|
||||
@ -363,15 +363,15 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
|
||||
// System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
|
||||
/* int x = ((int) e.getX()) / scaleFactor;
|
||||
int y = ((int) e.getY()) / scaleFactor;*/
|
||||
/* int x = ((int) e.getX()) * scaleFactor;
|
||||
int y = ((int) e.getY()) * scaleFactor;*/
|
||||
if(e.getHistorySize() > 0 && CallbackBridge.isGrabbing()) {
|
||||
x += (int)(e.getX() - e.getHistoricalX(0));
|
||||
y += (int)(e.getY() - e.getHistoricalY(0));
|
||||
}
|
||||
if(!CallbackBridge.isGrabbing()) {
|
||||
x = (int) (e.getX() / scaleFactor);
|
||||
y = (int) (e.getY() / scaleFactor);
|
||||
x = (int) (e.getX() * scaleFactor);
|
||||
y = (int) (e.getY() * scaleFactor);
|
||||
}
|
||||
|
||||
int hudKeyHandled = handleGuiBar((int)e.getX(), (int)e.getY());
|
||||
@ -489,8 +489,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
|
||||
/*
|
||||
int x = ((int) e.getX()) / scaleFactor;
|
||||
int y = (minecraftGLView.getHeight() - ((int) e.getY())) / scaleFactor;
|
||||
int x = ((int) e.getX()) * scaleFactor;
|
||||
int y = (minecraftGLView.getHeight() - ((int) e.getY())) * scaleFactor;
|
||||
int hudKeyHandled = handleGuiBar(x, y, e);
|
||||
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)) {
|
||||
if (hudKeyHandled != -1) {
|
||||
@ -602,11 +602,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCapturedPointer (View view, MotionEvent e) {
|
||||
x += ((int) e.getX()) / scaleFactor;
|
||||
y += ((int) e.getY()) / scaleFactor;
|
||||
if(!CallbackBridge.isGrabbing()){
|
||||
view.releasePointerCapture();
|
||||
}
|
||||
x += ((int) e.getX()) * scaleFactor;
|
||||
y += ((int) e.getY()) * scaleFactor;
|
||||
|
||||
if (debugText.getVisibility() == View.VISIBLE && !debugErrored) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
try {
|
||||
@ -656,11 +654,11 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
private boolean isCalled = false;
|
||||
@Override
|
||||
public void onSurfaceTextureAvailable(SurfaceTexture texture, int width, int height) {
|
||||
scaleFactor = (LauncherPreferences.DEFAULT_PREF.getInt("resolutionRatio",0)/100f) + 1f;
|
||||
texture.setDefaultBufferSize((int)(width/scaleFactor),(int)(height/scaleFactor));
|
||||
CallbackBridge.windowWidth = (int)(width/scaleFactor);
|
||||
CallbackBridge.windowHeight = (int)(height/scaleFactor);
|
||||
//CallbackBridge.sendUpdateWindowSize((int)(width/scaleFactor),(int)(height/scaleFactor));
|
||||
scaleFactor = (LauncherPreferences.DEFAULT_PREF.getInt("resolutionRatio",100)/100f);
|
||||
texture.setDefaultBufferSize((int)(width*scaleFactor),(int)(height*scaleFactor));
|
||||
CallbackBridge.windowWidth = (int)(width*scaleFactor);
|
||||
CallbackBridge.windowHeight = (int)(height*scaleFactor);
|
||||
//CallbackBridge.sendUpdateWindowSize((int)(width*scaleFactor),(int)(height*scaleFactor));
|
||||
MCOptionUtils.load();
|
||||
MCOptionUtils.set("overrideWidth", ""+CallbackBridge.windowWidth);
|
||||
MCOptionUtils.set("overrideHeight", ""+CallbackBridge.windowHeight);
|
||||
@ -694,9 +692,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
@Override
|
||||
public void onSurfaceTextureSizeChanged(SurfaceTexture texture, int width, int height) {
|
||||
CallbackBridge.windowWidth = (int)(width/scaleFactor);
|
||||
CallbackBridge.windowHeight = (int)(height/scaleFactor);
|
||||
CallbackBridge.sendUpdateWindowSize((int)(width/scaleFactor),(int)(height/scaleFactor));
|
||||
CallbackBridge.windowWidth = (int)(width*scaleFactor);
|
||||
CallbackBridge.windowHeight = (int)(height*scaleFactor);
|
||||
CallbackBridge.sendUpdateWindowSize((int)(width*scaleFactor),(int)(height*scaleFactor));
|
||||
calculateMcScale();
|
||||
}
|
||||
|
||||
@ -753,9 +751,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
switch(ev.getActionMasked()) {
|
||||
case MotionEvent.ACTION_HOVER_MOVE:
|
||||
CallbackBridge.mouseX = (int) (ev.getX(mouseCursorIndex)/scaleFactor);
|
||||
CallbackBridge.mouseY = (int) (ev.getY(mouseCursorIndex)/scaleFactor);
|
||||
CallbackBridge.sendCursorPos((int) (ev.getX(mouseCursorIndex)/scaleFactor), (int) (ev.getY(mouseCursorIndex)/scaleFactor));
|
||||
CallbackBridge.mouseX = (int) (ev.getX(mouseCursorIndex)*scaleFactor);
|
||||
CallbackBridge.mouseY = (int) (ev.getY(mouseCursorIndex)*scaleFactor);
|
||||
CallbackBridge.sendCursorPos((int) (ev.getX(mouseCursorIndex)*scaleFactor), (int) (ev.getY(mouseCursorIndex)*scaleFactor));
|
||||
return true;
|
||||
case MotionEvent.ACTION_SCROLL:
|
||||
CallbackBridge.sendScroll((double) ev.getAxisValue(MotionEvent.AXIS_VSCROLL), (double) ev.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
||||
|
BIN
app_pojavlauncher/src/main/res/drawable/resolution_scaler.png
Executable file
BIN
app_pojavlauncher/src/main/res/drawable/resolution_scaler.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
@ -95,6 +95,8 @@
|
||||
<string name="mcl_setting_subtitle_freeform">Launch Minecraft in floating window. Requires Android 7.0+</string>
|
||||
<string name="mcl_setting_title_hide_sidebar">Hide Sidebar</string>
|
||||
<string name="mcl_setting_subtitle_hide_sidebar">Nostalgic folks preferring the old v1 UI might like this. Gives you a more fullscreen experience.</string>
|
||||
<string name="mcl_setting_title_resolution_scaler">Resolution Scaler</string>
|
||||
<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_buttonscale">Control buttons scaling</string>
|
||||
@ -226,6 +228,4 @@
|
||||
<string name="auto_ram_subtitle">Enables automatic RAM adjuster</string>
|
||||
<string name="auto_ram_title">Auto RAM</string>
|
||||
<string name="autoram_info_msg">Memory set to %d MB</string>
|
||||
<string name="resolution_decrease_subtitle">Allows you to decrease the game resolution. Improves framerate. 0 is the default.</string>
|
||||
<string name="resolution_decrease_title">Resolution decrease ratio</string>
|
||||
</resources>
|
||||
|
@ -20,11 +20,11 @@
|
||||
app2:icon="@drawable/tap_len" />
|
||||
<net.kdt.pojavlaunch.prefs.CustomSeekBarPreference
|
||||
android:key="resolutionRatio"
|
||||
android:summary="@string/resolution_decrease_subtitle"
|
||||
android:title="@string/resolution_decrease_title"
|
||||
android:max="500"
|
||||
android:summary="@string/mcl_setting_subtitle_resolution_scaler"
|
||||
android:title="@string/mcl_setting_title_resolution_scaler"
|
||||
app2:showSeekBarValue="true"
|
||||
app2:selectable="false" />
|
||||
app2:selectable="false"
|
||||
app2:icon="@drawable/resolution_scaler"/>
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="freeform"
|
||||
|
Loading…
x
Reference in New Issue
Block a user