Merge commit 'ee14e180bcd0e35d9407eb535a54511e9e3e0958'

Conflicts solved:
	app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/BaseMainActivity.java
This commit is contained in:
SerpentSpirale 2021-01-26 12:37:35 +01:00
commit 1a7a710121
4 changed files with 32 additions and 34 deletions

View File

@ -135,8 +135,8 @@ public class BaseMainActivity extends LoggableActivity {
isInputStackCall = mVersionInfo.arguments != null; isInputStackCall = mVersionInfo.arguments != null;
this.displayMetrics = Tools.getDisplayMetrics(this); this.displayMetrics = Tools.getDisplayMetrics(this);
CallbackBridge.windowWidth = (int) ((float)displayMetrics.widthPixels / scaleFactor); CallbackBridge.windowWidth = (int) ((float)displayMetrics.widthPixels * scaleFactor);
CallbackBridge.windowHeight = (int) ((float)displayMetrics.heightPixels / scaleFactor); CallbackBridge.windowHeight = (int) ((float)displayMetrics.heightPixels * scaleFactor);
System.out.println("WidthHeight: " + CallbackBridge.windowWidth + ":" + CallbackBridge.windowHeight); System.out.println("WidthHeight: " + CallbackBridge.windowWidth + ":" + CallbackBridge.windowHeight);
@ -293,7 +293,7 @@ public class BaseMainActivity extends LoggableActivity {
if (gestureDetector.onTouchEvent(event)) { 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); CallbackBridge.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT);
if (!rightOverride) { if (!rightOverride) {
CallbackBridge.mouseLeft = true; CallbackBridge.mouseLeft = true;
@ -313,7 +313,7 @@ public class BaseMainActivity extends LoggableActivity {
mouseY = Math.max(0, Math.min(displayMetrics.heightPixels, mouseY + y - prevY)); mouseY = Math.max(0, Math.min(displayMetrics.heightPixels, mouseY + y - prevY));
placeMouseAt(mouseX, mouseY); placeMouseAt(mouseX, mouseY);
CallbackBridge.sendCursorPos((int) (mouseX / scaleFactor), (int) (mouseY /scaleFactor)); CallbackBridge.sendCursorPos((int) (mouseX * scaleFactor), (int) (mouseY *scaleFactor));
/* /*
if (!CallbackBridge.isGrabbing()) { if (!CallbackBridge.isGrabbing()) {
CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, 0, isLeftMouseDown); CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, 0, isLeftMouseDown);
@ -353,8 +353,8 @@ public class BaseMainActivity extends LoggableActivity {
} }
if (mptrIndex != -1) { if (mptrIndex != -1) {
//handle mouse events by just sending the coords of the new point in touch event //handle mouse events by just sending the coords of the new point in touch event
int x = (int) (e.getX(mptrIndex) / scaleFactor); int x = (int) (e.getX(mptrIndex) * scaleFactor);
int y = (int) (e.getY(mptrIndex) / scaleFactor); int y = (int) (e.getY(mptrIndex) * scaleFactor);
CallbackBridge.mouseX = x; CallbackBridge.mouseX = x;
CallbackBridge.mouseY = y; CallbackBridge.mouseY = y;
CallbackBridge.sendCursorPos(x, 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())); // System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
/* int x = ((int) e.getX()) / scaleFactor; /* int x = ((int) e.getX()) * scaleFactor;
int y = ((int) e.getY()) / scaleFactor;*/ int y = ((int) e.getY()) * scaleFactor;*/
if(e.getHistorySize() > 0 && CallbackBridge.isGrabbing()) { if(e.getHistorySize() > 0 && CallbackBridge.isGrabbing()) {
x += (int)(e.getX() - e.getHistoricalX(0)); x += (int)(e.getX() - e.getHistoricalX(0));
y += (int)(e.getY() - e.getHistoricalY(0)); y += (int)(e.getY() - e.getHistoricalY(0));
} }
if(!CallbackBridge.isGrabbing()) { if(!CallbackBridge.isGrabbing()) {
x = (int) (e.getX() / scaleFactor); x = (int) (e.getX() * scaleFactor);
y = (int) (e.getY() / scaleFactor); y = (int) (e.getY() * scaleFactor);
} }
int hudKeyHandled = handleGuiBar((int)e.getX(), (int)e.getY()); 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 x = ((int) e.getX()) * scaleFactor;
int y = (minecraftGLView.getHeight() - ((int) e.getY())) / scaleFactor; int y = (minecraftGLView.getHeight() - ((int) e.getY())) * scaleFactor;
int hudKeyHandled = handleGuiBar(x, y, e); int hudKeyHandled = handleGuiBar(x, y, e);
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)) { if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)) {
if (hudKeyHandled != -1) { if (hudKeyHandled != -1) {
@ -602,11 +602,9 @@ public class BaseMainActivity extends LoggableActivity {
@Override @Override
public boolean onCapturedPointer (View view, MotionEvent e) { public boolean onCapturedPointer (View view, MotionEvent e) {
x += ((int) e.getX()) / scaleFactor; x += ((int) e.getX()) * scaleFactor;
y += ((int) e.getY()) / scaleFactor; y += ((int) e.getY()) * scaleFactor;
if(!CallbackBridge.isGrabbing()){
view.releasePointerCapture();
}
if (debugText.getVisibility() == View.VISIBLE && !debugErrored) { if (debugText.getVisibility() == View.VISIBLE && !debugErrored) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
try { try {
@ -656,11 +654,11 @@ public class BaseMainActivity extends LoggableActivity {
private boolean isCalled = false; private boolean isCalled = false;
@Override @Override
public void onSurfaceTextureAvailable(SurfaceTexture texture, int width, int height) { public void onSurfaceTextureAvailable(SurfaceTexture texture, int width, int height) {
scaleFactor = (LauncherPreferences.DEFAULT_PREF.getInt("resolutionRatio",0)/100f) + 1f; scaleFactor = (LauncherPreferences.DEFAULT_PREF.getInt("resolutionRatio",100)/100f);
texture.setDefaultBufferSize((int)(width/scaleFactor),(int)(height/scaleFactor)); texture.setDefaultBufferSize((int)(width*scaleFactor),(int)(height*scaleFactor));
CallbackBridge.windowWidth = (int)(width/scaleFactor); CallbackBridge.windowWidth = (int)(width*scaleFactor);
CallbackBridge.windowHeight = (int)(height/scaleFactor); CallbackBridge.windowHeight = (int)(height*scaleFactor);
//CallbackBridge.sendUpdateWindowSize((int)(width/scaleFactor),(int)(height/scaleFactor)); //CallbackBridge.sendUpdateWindowSize((int)(width*scaleFactor),(int)(height*scaleFactor));
MCOptionUtils.load(); MCOptionUtils.load();
MCOptionUtils.set("overrideWidth", ""+CallbackBridge.windowWidth); MCOptionUtils.set("overrideWidth", ""+CallbackBridge.windowWidth);
MCOptionUtils.set("overrideHeight", ""+CallbackBridge.windowHeight); MCOptionUtils.set("overrideHeight", ""+CallbackBridge.windowHeight);
@ -694,9 +692,9 @@ public class BaseMainActivity extends LoggableActivity {
@Override @Override
public void onSurfaceTextureSizeChanged(SurfaceTexture texture, int width, int height) { public void onSurfaceTextureSizeChanged(SurfaceTexture texture, int width, int height) {
CallbackBridge.windowWidth = (int)(width/scaleFactor); CallbackBridge.windowWidth = (int)(width*scaleFactor);
CallbackBridge.windowHeight = (int)(height/scaleFactor); CallbackBridge.windowHeight = (int)(height*scaleFactor);
CallbackBridge.sendUpdateWindowSize((int)(width/scaleFactor),(int)(height/scaleFactor)); CallbackBridge.sendUpdateWindowSize((int)(width*scaleFactor),(int)(height*scaleFactor));
calculateMcScale(); calculateMcScale();
} }
@ -753,9 +751,9 @@ public class BaseMainActivity extends LoggableActivity {
} }
switch(ev.getActionMasked()) { switch(ev.getActionMasked()) {
case MotionEvent.ACTION_HOVER_MOVE: case MotionEvent.ACTION_HOVER_MOVE:
CallbackBridge.mouseX = (int) (ev.getX(mouseCursorIndex)/scaleFactor); CallbackBridge.mouseX = (int) (ev.getX(mouseCursorIndex)*scaleFactor);
CallbackBridge.mouseY = (int) (ev.getY(mouseCursorIndex)/scaleFactor); CallbackBridge.mouseY = (int) (ev.getY(mouseCursorIndex)*scaleFactor);
CallbackBridge.sendCursorPos((int) (ev.getX(mouseCursorIndex)/scaleFactor), (int) (ev.getY(mouseCursorIndex)/scaleFactor)); CallbackBridge.sendCursorPos((int) (ev.getX(mouseCursorIndex)*scaleFactor), (int) (ev.getY(mouseCursorIndex)*scaleFactor));
return true; return true;
case MotionEvent.ACTION_SCROLL: case MotionEvent.ACTION_SCROLL:
CallbackBridge.sendScroll((double) ev.getAxisValue(MotionEvent.AXIS_VSCROLL), (double) ev.getAxisValue(MotionEvent.AXIS_HSCROLL)); CallbackBridge.sendScroll((double) ev.getAxisValue(MotionEvent.AXIS_VSCROLL), (double) ev.getAxisValue(MotionEvent.AXIS_HSCROLL));

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -95,6 +95,8 @@
<string name="mcl_setting_subtitle_freeform">Launch Minecraft in floating window. Requires Android 7.0+</string> <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_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_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_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_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> <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_subtitle">Enables automatic RAM adjuster</string>
<string name="auto_ram_title">Auto RAM</string> <string name="auto_ram_title">Auto RAM</string>
<string name="autoram_info_msg">Memory set to %d MB</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> </resources>

View File

@ -20,11 +20,11 @@
app2:icon="@drawable/tap_len" /> app2:icon="@drawable/tap_len" />
<net.kdt.pojavlaunch.prefs.CustomSeekBarPreference <net.kdt.pojavlaunch.prefs.CustomSeekBarPreference
android:key="resolutionRatio" android:key="resolutionRatio"
android:summary="@string/resolution_decrease_subtitle" android:summary="@string/mcl_setting_subtitle_resolution_scaler"
android:title="@string/resolution_decrease_title" android:title="@string/mcl_setting_title_resolution_scaler"
android:max="500"
app2:showSeekBarValue="true" app2:showSeekBarValue="true"
app2:selectable="false" /> app2:selectable="false"
app2:icon="@drawable/resolution_scaler"/>
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="freeform" android:key="freeform"