mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 13:30:15 -07:00
Bug fixes
- Pointer capture not working (partial fixes #513). - Game brighter than normal.
This commit is contained in:
parent
c5fe413f97
commit
3187fe5cdc
50 changed files with 695 additions and 74 deletions
|
|
@ -11,7 +11,6 @@ import android.view.inputmethod.*;
|
|||
import android.widget.*;
|
||||
import androidx.drawerlayout.widget.*;
|
||||
import com.google.android.material.navigation.*;
|
||||
import com.kdt.pointer.*;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
|
@ -84,8 +83,6 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
|
||||
private TextView debugText;
|
||||
|
||||
private PointerOreoWrapper pointerSurface;
|
||||
|
||||
// private String mQueueText = new String();
|
||||
|
||||
protected JMinecraftVersionList.Version mVersionInfo;
|
||||
|
|
@ -245,12 +242,14 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
touchPad.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (isPointerCaptureSupported()) {
|
||||
if (isAndroid8OrHigher()) {
|
||||
if (!CallbackBridge.isGrabbing() && isCapturing) {
|
||||
pointerSurface.releaseCapture(); // minecraftGLView.releasePointerCapture();
|
||||
minecraftGLView.releasePointerCapture();
|
||||
minecraftGLView.clearFocus();
|
||||
isCapturing = false;
|
||||
} else if (CallbackBridge.isGrabbing() && !isCapturing) {
|
||||
pointerSurface.requestCapture(); // minecraftGLView.requestPointerCapture();
|
||||
minecraftGLView.requestFocus();
|
||||
minecraftGLView.requestPointerCapture();
|
||||
isCapturing = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -326,8 +325,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
|
||||
// System.loadLibrary("Regal");
|
||||
|
||||
minecraftGLView.setFocusable(false);
|
||||
minecraftGLView.setFocusableInTouchMode(false);
|
||||
minecraftGLView.setFocusable(true);
|
||||
// minecraftGLView.setEGLContextClientVersion(2);
|
||||
|
||||
glTouchListener = new OnTouchListener(){
|
||||
|
|
@ -550,24 +548,24 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
};
|
||||
|
||||
if (isPointerCaptureSupported()) {
|
||||
this.pointerSurface = new PointerOreoWrapper(minecraftGLView);
|
||||
this.pointerSurface.setOnCapturedPointerListener(new PointerOreoWrapper.OnCapturedPointerListener(){
|
||||
private int x, y;
|
||||
private boolean debugErrored = false;
|
||||
if (isAndroid8OrHigher()) {
|
||||
minecraftGLView.setDefaultFocusHighlightEnabled(false);
|
||||
minecraftGLView.setOnCapturedPointerListener(new View.OnCapturedPointerListener() {
|
||||
private int x, y;
|
||||
private boolean debugErrored = false;
|
||||
|
||||
private String getMoving(float pos, boolean xOrY) {
|
||||
if (pos == 0) {
|
||||
return "STOPPED";
|
||||
} else if (pos > 0) {
|
||||
return xOrY ? "RIGHT" : "DOWN";
|
||||
} else { // if (pos3 < 0) {
|
||||
return xOrY ? "LEFT" : "UP";
|
||||
}
|
||||
private String getMoving(float pos, boolean xOrY) {
|
||||
if (pos == 0) {
|
||||
return "STOPPED";
|
||||
} else if (pos > 0) {
|
||||
return xOrY ? "RIGHT" : "DOWN";
|
||||
} else { // if (pos3 < 0) {
|
||||
return xOrY ? "LEFT" : "UP";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCapturedPointer(View view, MotionEvent e) {
|
||||
@Override
|
||||
public boolean onCapturedPointer (View view, MotionEvent e) {
|
||||
x += ((int) e.getX()) / scaleFactor;
|
||||
y -= ((int) e.getY()) / scaleFactor;
|
||||
|
||||
|
|
@ -666,7 +664,6 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
});
|
||||
minecraftGLView.setOnTouchListener(glTouchListener);
|
||||
|
||||
minecraftGLView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener(){
|
||||
|
||||
private boolean isCalled = false;
|
||||
|
|
@ -805,7 +802,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isPointerCaptureSupported() {
|
||||
private boolean isAndroid8OrHigher() {
|
||||
return Build.VERSION.SDK_INT >= 26;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue