mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 00:29:50 -04:00
Changes
- [Custom controls] Changed some maths in calculating generated control. - [Custom controls design] Try to fix hold issue. - [ingame] Try to fix pointer capture issue.
This commit is contained in:
parent
ec819ba538
commit
1373a76e74
@ -311,14 +311,14 @@ public abstract class HandleView extends View implements ViewPositionListener, V
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MOD: Addition
|
// Addition
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
showActionPopupWindow(0);
|
showActionPopupWindow(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MOD: Addition
|
// Addition
|
||||||
private float mDownX, mDownY;
|
private float mDownX, mDownY;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,7 +83,6 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
private TextView debugText;
|
private TextView debugText;
|
||||||
|
|
||||||
private PointerOreoWrapper pointerSurface;
|
private PointerOreoWrapper pointerSurface;
|
||||||
private View.OnTouchListener pointerCaptureListener;
|
|
||||||
|
|
||||||
// private String mQueueText = new String();
|
// private String mQueueText = new String();
|
||||||
|
|
||||||
@ -530,7 +529,9 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pointerCaptureListener = new OnTouchListener(){
|
if (isPointerCaptureSupported()) {
|
||||||
|
this.pointerSurface = new PointerOreoWrapper(minecraftGLView);
|
||||||
|
this.pointerSurface.setOnCapturedPointerListener(new PointerOreoWrapper.OnCapturedPointerListener(){
|
||||||
private int x, y;
|
private int x, y;
|
||||||
private boolean debugErrored = false;
|
private boolean debugErrored = false;
|
||||||
|
|
||||||
@ -545,8 +546,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View p1, 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;
|
||||||
|
|
||||||
@ -627,15 +627,6 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
return true;
|
return true;
|
||||||
// If onClick fail with false, change back to true
|
// If onClick fail with false, change back to true
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (isPointerCaptureSupported()) {
|
|
||||||
this.pointerSurface = new PointerOreoWrapper(minecraftGLView);
|
|
||||||
this.pointerSurface.setOnCapturedPointerListener(new PointerOreoWrapper.OnCapturedPointerListener(){
|
|
||||||
@Override
|
|
||||||
public boolean onCapturedPointer(View view, MotionEvent event) {
|
|
||||||
return pointerCaptureListener.onTouch(view, event);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,12 +140,13 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (event.getActionMasked()) {
|
switch (event.getActionMasked()) {
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
mCanTriggerLongClick = true;
|
mCanTriggerLongClick = true;
|
||||||
downX = event.getX();
|
downX = event.getX();
|
||||||
downY = event.getY();
|
downY = event.getY();
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
mCanTriggerLongClick = false;
|
mCanTriggerLongClick = false;
|
||||||
moveX += event.getX() - downX;
|
moveX += event.getX() - downX;
|
||||||
|
@ -40,7 +40,7 @@ public class ControlData implements Cloneable
|
|||||||
if (SPECIAL_BUTTONS == null) {
|
if (SPECIAL_BUTTONS == null) {
|
||||||
ControlData[] specialButtons = new ControlData[]{
|
ControlData[] specialButtons = new ControlData[]{
|
||||||
new ControlData("Keyboard", SPECIALBTN_KEYBOARD, "${margin} * 3 + ${width} * 2", "${margin}", false),
|
new ControlData("Keyboard", SPECIALBTN_KEYBOARD, "${margin} * 3 + ${width} * 2", "${margin}", false),
|
||||||
new ControlData("GUI", SPECIALBTN_TOGGLECTRL, "${margin}", "${bottom}"),
|
new ControlData("GUI", SPECIALBTN_TOGGLECTRL, "${margin}", "${bottom} - ${margin}"),
|
||||||
new ControlData("PRI", SPECIALBTN_MOUSEPRI, "${margin}", "${screen_height} - ${margin} * 3 - ${height} * 3"),
|
new ControlData("PRI", SPECIALBTN_MOUSEPRI, "${margin}", "${screen_height} - ${margin} * 3 - ${height} * 3"),
|
||||||
new ControlData("SEC", SPECIALBTN_MOUSESEC, "${margin} * 3 + ${width} * 2", "${screen_height} - ${margin} * 3 - ${height} * 3"),
|
new ControlData("SEC", SPECIALBTN_MOUSESEC, "${margin} * 3 + ${width} * 2", "${screen_height} - ${margin} * 3 - ${height} * 3"),
|
||||||
new ControlData("Mouse", SPECIALBTN_VIRTUALMOUSE, "${right}", "${margin}", false)
|
new ControlData("Mouse", SPECIALBTN_VIRTUALMOUSE, "${right}", "${margin}", false)
|
||||||
|
@ -30,14 +30,14 @@ public class CustomControls
|
|||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_listplayers, LWJGLGLFWKeycode.GLFW_KEY_TAB, "${margin} * 4 + ${width} * 3", "${margin}", false));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_listplayers, LWJGLGLFWKeycode.GLFW_KEY_TAB, "${margin} * 4 + ${width} * 3", "${margin}", false));
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_thirdperson, LWJGLGLFWKeycode.GLFW_KEY_F5, "${margin}", "${height} + ${margin}", false));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_thirdperson, LWJGLGLFWKeycode.GLFW_KEY_F5, "${margin}", "${height} + ${margin}", false));
|
||||||
|
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_up, LWJGLGLFWKeycode.GLFW_KEY_W, "${margin} * 2 + ${width}", "${screen_height} - ${margin} * 3 - ${height} * 3", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_up, LWJGLGLFWKeycode.GLFW_KEY_W, "${margin} * 2 + ${width}", "${bottom} - ${margin} * 3 - ${height} * 2", true));
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_left, LWJGLGLFWKeycode.GLFW_KEY_A, "${margin}", "${screen_height} - ${margin} * 2 - ${height} * 2", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_left, LWJGLGLFWKeycode.GLFW_KEY_A, "${margin}", "${bottom} - ${margin} * 2 - ${height}", true));
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_down, LWJGLGLFWKeycode.GLFW_KEY_S, "${margin} * 2 + ${width}", "${screen_height} - ${margin} - ${width}", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_down, LWJGLGLFWKeycode.GLFW_KEY_S, "${margin} * 2 + ${width}", "${bottom} - ${margin}", true));
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_right, LWJGLGLFWKeycode.GLFW_KEY_D, "${margin} * 3 + ${width} * 2", "${screen_height} - ${margin} * 2 - ${width} * 2", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_right, LWJGLGLFWKeycode.GLFW_KEY_D, "${margin} * 3 + ${width} * 2", "${bottom} - ${margin} * 2 - ${height}", true));
|
||||||
|
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_inventory, LWJGLGLFWKeycode.GLFW_KEY_E, "${margin} * 3 + ${width} * 2", "${screen_height} - ${margin} - ${width}", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_inventory, LWJGLGLFWKeycode.GLFW_KEY_E, "${margin} * 3 + ${width} * 2", "${bottom} - ${margin}", true));
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_shift, LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, "${margin} * 2 + ${width}", "${screen_height} - ${margin} * 2 - ${width} * 2", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_shift, LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, "${margin} * 2 + ${width}", "${screen_height} - ${margin} * 2 - ${height} * 2", true));
|
||||||
this.mControlDataList.add(new ControlData(ctx, R.string.control_jump, LWJGLGLFWKeycode.GLFW_KEY_SPACE, "${screen_width} - ${margin} * 3 - ${width} * 2", "${screen_height} - ${margin} * 2 - ${width} * 2", true));
|
this.mControlDataList.add(new ControlData(ctx, R.string.control_jump, LWJGLGLFWKeycode.GLFW_KEY_SPACE, "${right} - ${margin} * 2 - ${width}", "${bottom} - ${margin} * 2 - ${height}", true));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user