diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8a0daf3e1..690fea61d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -62,6 +62,13 @@
android:screenOrientation="sensorLandscape"
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize|keyboard|navigation"/>
+
+
0) {
- undertop.removeAllViews();
- }
- undertop.addView(view);
- }
-
- public void setMenuVisible(boolean value) {
- menu.setVisibility(value ? View.VISIBLE : View.GONE);
- }
-
- public void setClick(int id) {
- findViewById(id).setOnClickListener(this);
- }
+ @Override
+ public void setContentView(View view)
+ {
+ if (!showBeforeView) {
+ mcUIInit();
+ }
+
+ content.addView(view);
+ if (view instanceof ViewGroup) {
+ FontChanger.changeFonts((ViewGroup) view);
+ }
+ }
+
+ @Override
+ public void onClick(View view)
+ {
+ switch (view.getId()) {
+ case R.id.topbar_help_text: Tools.openURL(this, "https://www.minecraft.net/help");
+ break;
+ case R.id.topbar_logo: Tools.openURL(this, "https://www.minecraft.net");
+ break;
+ case R.id.bottombar_author_logo: Tools.openURL(this, "https://mojang.com");
+ break;
+ }
+ }
+
+ public void setUndertopView(View view) {
+ if (undertop.getChildCount() > 0) {
+ undertop.removeAllViews();
+ }
+ undertop.addView(view);
+ }
+
+ public void setMenuVisible(boolean value) {
+ menu.setVisibility(value ? View.VISIBLE : View.GONE);
+ }
+
+ public void setClick(int id) {
+ findViewById(id).setOnClickListener(this);
+ }
}
diff --git a/app/src/main/java/net/kdt/pojavlaunch/BaseMainActivity.java b/app/src/main/java/net/kdt/pojavlaunch/BaseMainActivity.java
index 3289ebd68..facfb70ba 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/BaseMainActivity.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/BaseMainActivity.java
@@ -20,7 +20,7 @@ import net.kdt.pojavlaunch.prefs.*;
import net.kdt.pojavlaunch.utils.*;
import org.lwjgl.glfw.*;
-public class BaseMainActivity extends LoggableActivity implements OnTouchListener {
+public class BaseMainActivity extends LoggableActivity {
public static volatile ClipboardManager GLOBAL_CLIPBOARD;
public static final String initText = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ";
@@ -106,11 +106,11 @@ public class BaseMainActivity extends LoggableActivity implements OnTouchListene
// private static Collection extends Provider.Service> rsaPkcs1List;
- @Override
- public void onCreate(Bundle savedInstanceState)
+ // @Override
+ public void onCreate(Bundle savedInstanceState, int resId)
{
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
+ setContentView(resId);
try {
// FIXME: is it safe fot multi thread?
@@ -196,14 +196,6 @@ public class BaseMainActivity extends LoggableActivity implements OnTouchListene
this.minecraftGLView = (MinecraftGLView) findViewById(R.id.main_game_render_view);
- ControlData[] specialButtons = ControlData.getSpecialButtons();
- specialButtons[0].specialButtonListener = new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- showKeyboard();
- }
- };
-
// toggleGui(null);
this.drawerLayout.closeDrawers();
@@ -649,9 +641,14 @@ public class BaseMainActivity extends LoggableActivity implements OnTouchListene
minecraftGLView.setOnHoverListener(new View.OnHoverListener(){
@Override
- public boolean onHover(View p1, MotionEvent p2) {
+ public boolean onHover(View v, MotionEvent e) {
if (!CallbackBridge.isGrabbing() && mIsResuming) {
- return glTouchListener.onTouch(p1, p2);
+ // return glTouchListener.onTouch(v, e);
+ int x = ((int) e.getX()) / scaleFactor;
+ int y = ((int) e.getY()) / scaleFactor;
+ CallbackBridge.mouseX = x;
+ CallbackBridge.mouseY = y;
+ CallbackBridge.sendCursorPos(x, y);
}
return true;
}
@@ -804,56 +801,6 @@ public class BaseMainActivity extends LoggableActivity implements OnTouchListene
super.onPause();
}
- public boolean onTouch(View v, MotionEvent e) {
- boolean isDown;
- switch (e.getActionMasked()) {
- case MotionEvent.ACTION_DOWN: // 0
- case MotionEvent.ACTION_POINTER_DOWN: // 5
- isDown = true;
- break;
- case MotionEvent.ACTION_UP: // 1
- case MotionEvent.ACTION_CANCEL: // 3
- case MotionEvent.ACTION_POINTER_UP: // 6
- isDown = false;
- break;
- default:
- return false;
- }
-
- switch (v.getId()) {
- case R.id.control_up: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_W, 0, isDown); break;
- case R.id.control_left: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_A, 0, isDown); break;
- case R.id.control_down: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_S, 0, isDown); break;
- case R.id.control_right: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_D, 0, isDown); break;
- case R.id.control_jump: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_SPACE, 0, isDown); break;
- case R.id.control_primary: sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown); break;
- case R.id.control_secondary:
- if (CallbackBridge.isGrabbing()) {
- sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
- } else {
- /*
- if (!isDown) {
- CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, CallbackBridge.mouseX, CallbackBridge.mouseY);
- }
- */
-
- CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
-
- setRightOverride(isDown);
- } break;
- case R.id.control_debug: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F3, 0, isDown); break;
- case R.id.control_shift: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, 0, isDown); break;
- case R.id.control_inventory: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_E, 0, isDown); break;
- case R.id.control_talk: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_T, 0, isDown); break;
- case R.id.control_keyboard: showKeyboard(); break;
- case R.id.control_thirdperson: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F5, 0, isDown); break;
- case R.id.control_zoom: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_C, 0, isDown); break;
- case R.id.control_listplayers: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_TAB, 0, isDown); break;
- }
-
- return false;
- }
-
public static void fullyExit() {
System.exit(0);
}
@@ -1102,16 +1049,6 @@ public class BaseMainActivity extends LoggableActivity implements OnTouchListene
.show();
}
- protected Button findButton(int id) {
- Button button = (Button) findViewById(id);
- button.setWidth((int) (button.getWidth() * Tools.currentDisplayMetrics.scaledDensity));
- button.setHeight((int) (button.getHeight() * LauncherPreferences.PREF_BUTTONSIZE));
- button.setOnTouchListener(this);
- button.setFocusable(false);
- button.setFocusableInTouchMode(false);
- return button;
- }
-
@Override
public void onBackPressed() {
// Prevent back
@@ -1133,7 +1070,7 @@ public class BaseMainActivity extends LoggableActivity implements OnTouchListene
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
- private void setRightOverride(boolean val) {
+ protected void setRightOverride(boolean val) {
this.rightOverride = val;
// this.secondaryButton.setBackgroundDrawable(this.rightOverride ? this.secondaryButtonColorBackground : this.secondaryButtonDefaultBackground);
}
diff --git a/app/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java b/app/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java
index 48883ba37..8870860ff 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java
@@ -26,7 +26,6 @@ public class CustomControlsActivity extends BaseActivity
public boolean isModified = false;
- private Gson gson;
private String selectedName = "new_control";
@Override
@@ -36,8 +35,6 @@ public class CustomControlsActivity extends BaseActivity
mPref = PreferenceManager.getDefaultSharedPreferences(this);
- gson = new GsonBuilder().setPrettyPrinting().create();
-
ctrlLayout = (ControlLayout) findViewById(R.id.customctrl_controllayout);
// Menu
@@ -206,7 +203,7 @@ public class CustomControlsActivity extends BaseActivity
private void loadControl(String path) {
try {
- mCtrl = gson.fromJson(Tools.read(path), CustomControls.class);
+ mCtrl = Tools.GLOBAL_GSON.fromJson(Tools.read(path), CustomControls.class);
ctrlLayout.loadLayout(mCtrl);
selectedName = new File(path).getName();
diff --git a/app/src/main/java/net/kdt/pojavlaunch/CustomCtrlMainActivity.java b/app/src/main/java/net/kdt/pojavlaunch/CustomCtrlMainActivity.java
new file mode 100644
index 000000000..be606685f
--- /dev/null
+++ b/app/src/main/java/net/kdt/pojavlaunch/CustomCtrlMainActivity.java
@@ -0,0 +1,101 @@
+package net.kdt.pojavlaunch;
+
+import android.os.*;
+import android.view.*;
+import android.view.View.*;
+import android.widget.*;
+import net.kdt.pojavlaunch.customcontrols.*;
+import net.kdt.pojavlaunch.prefs.*;
+import org.lwjgl.glfw.*;
+
+public class CustomCtrlMainActivity extends BaseMainActivity implements OnClickListener, OnTouchListener {
+ private CustomControls mControl;
+ private ControlLayout mControlLayout;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState, R.layout.main_with_customctrl);
+
+ ControlData[] specialButtons = ControlData.getSpecialButtons();
+ for (ControlData specialButton : specialButtons) {
+ specialButton.specialButtonListener = this;
+ }
+
+ mControlLayout = findViewById(R.id.main_control_layout);
+ mControl = new CustomControls();
+ mControlLayout.setModifiable(false);
+ loadControl(LauncherPreferences.PREF_DEFAULTCTRL_PATH);
+ mControlLayout.loadLayout(mControl);
+
+ // toggleGui(null);
+ mControlLayout.toggleControlVisible();
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (view instanceof ControlButton) {
+ ControlButton button = (ControlButton) view;
+ switch (button.getProperties().keycode) {
+ case ControlData.SPECIALBTN_KEYBOARD:
+ showKeyboard();
+ break;
+
+ case ControlData.SPECIALBTN_TOGGLECTRL:
+ mControlLayout.toggleControlVisible();
+ break;
+
+ case ControlData.SPECIALBTN_VIRTUALMOUSE:
+ toggleMouse(button);
+ break;
+ }
+ }
+ }
+
+ @Override
+ public boolean onTouch(View view, MotionEvent e) {
+ boolean isDown;
+ switch (e.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN: // 0
+ case MotionEvent.ACTION_POINTER_DOWN: // 5
+ isDown = true;
+ break;
+ case MotionEvent.ACTION_UP: // 1
+ case MotionEvent.ACTION_CANCEL: // 3
+ case MotionEvent.ACTION_POINTER_UP: // 6
+ isDown = false;
+ break;
+ default:
+ return false;
+ }
+
+ if (view instanceof ControlButton) {
+ ControlButton button = (ControlButton) view;
+ switch (button.getProperties().keycode) {
+ case ControlData.SPECIALBTN_MOUSEPRI:
+ sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
+ break;
+
+ case ControlData.SPECIALBTN_MOUSESEC:
+ if (CallbackBridge.isGrabbing()) {
+ sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
+ } else {
+ CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
+
+ setRightOverride(isDown);
+ }
+ break;
+ }
+ }
+
+ return false;
+ }
+
+ private void loadControl(String path) {
+ try {
+ mControl = Tools.GLOBAL_GSON.fromJson(Tools.read(path), CustomControls.class);
+ mControlLayout.loadLayout(mControl);
+ } catch (Exception e) {
+ Tools.showError(this, e);
+ }
+ }
+}
diff --git a/app/src/main/java/net/kdt/pojavlaunch/MainActivity.java b/app/src/main/java/net/kdt/pojavlaunch/MainActivity.java
index 63f8e1030..e1c4b6f38 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/MainActivity.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/MainActivity.java
@@ -5,8 +5,10 @@ import android.view.*;
import android.view.View.*;
import android.widget.*;
import net.kdt.pojavlaunch.customcontrols.*;
+import net.kdt.pojavlaunch.prefs.*;
+import org.lwjgl.glfw.*;
-public class MainActivity extends BaseMainActivity implements OnClickListener {
+public class MainActivity extends BaseMainActivity implements OnClickListener, OnTouchListener {
private Button upButton,
downButton, leftButton,
rightButton, jumpButton,
@@ -21,7 +23,7 @@ public class MainActivity extends BaseMainActivity implements OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState, R.layout.main);
this.upButton = findButton(R.id.control_up);
this.downButton = findButton(R.id.control_down);
@@ -76,4 +78,64 @@ public class MainActivity extends BaseMainActivity implements OnClickListener {
}
}
}
+
+ public boolean onTouch(View v, MotionEvent e) {
+ boolean isDown;
+ switch (e.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN: // 0
+ case MotionEvent.ACTION_POINTER_DOWN: // 5
+ isDown = true;
+ break;
+ case MotionEvent.ACTION_UP: // 1
+ case MotionEvent.ACTION_CANCEL: // 3
+ case MotionEvent.ACTION_POINTER_UP: // 6
+ isDown = false;
+ break;
+ default:
+ return false;
+ }
+
+ switch (v.getId()) {
+ case R.id.control_up: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_W, 0, isDown); break;
+ case R.id.control_left: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_A, 0, isDown); break;
+ case R.id.control_down: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_S, 0, isDown); break;
+ case R.id.control_right: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_D, 0, isDown); break;
+ case R.id.control_jump: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_SPACE, 0, isDown); break;
+ case R.id.control_primary: sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown); break;
+ case R.id.control_secondary:
+ if (CallbackBridge.isGrabbing()) {
+ sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
+ } else {
+ /*
+ if (!isDown) {
+ CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, CallbackBridge.mouseX, CallbackBridge.mouseY);
+ }
+ */
+
+ CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
+
+ setRightOverride(isDown);
+ } break;
+ case R.id.control_debug: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F3, 0, isDown); break;
+ case R.id.control_shift: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, 0, isDown); break;
+ case R.id.control_inventory: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_E, 0, isDown); break;
+ case R.id.control_talk: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_T, 0, isDown); break;
+ case R.id.control_keyboard: showKeyboard(); break;
+ case R.id.control_thirdperson: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F5, 0, isDown); break;
+ case R.id.control_zoom: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_C, 0, isDown); break;
+ case R.id.control_listplayers: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_TAB, 0, isDown); break;
+ }
+
+ return false;
+ }
+
+ private Button findButton(int id) {
+ Button button = (Button) findViewById(id);
+ button.setWidth((int) (button.getWidth() * Tools.currentDisplayMetrics.scaledDensity));
+ button.setHeight((int) (button.getHeight() * LauncherPreferences.PREF_BUTTONSIZE));
+ button.setOnTouchListener(this);
+ button.setFocusable(false);
+ button.setFocusableInTouchMode(false);
+ return button;
+ }
}
diff --git a/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java b/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java
index b24aa9b3e..df59931f5 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java
@@ -23,6 +23,9 @@ public class ControlData implements Cloneable
private static ControlData[] SPECIAL_BUTTONS;
private static String[] SPECIAL_BUTTON_NAME_ARRAY;
+ // Internal usage only
+ public boolean isHideable;
+
/**
* Both fields below are dynamic position data, auto updates
* X and Y position, unlike the original one which uses fixed
@@ -135,7 +138,13 @@ public class ControlData implements Cloneable
}
public void update() {
- if (!isDynamicBtn) {
+ if (keycode < 0) {
+ for (ControlData data : getSpecialButtons()) {
+ if (keycode == data.keycode) {
+ specialButtonListener = data.specialButtonListener;
+ }
+ }
+ } if (!isDynamicBtn) {
return;
}
diff --git a/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java b/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java
index f3e5b3c50..b8c30b58f 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java
@@ -6,6 +6,7 @@ import android.view.*;
import com.google.gson.*;
import net.kdt.pojavlaunch.*;
import android.support.v7.app.*;
+import java.util.*;
public class ControlLayout extends FrameLayout
{
@@ -13,6 +14,7 @@ public class ControlLayout extends FrameLayout
private CustomControls mLayout;
private CustomControlsActivity mActivity;
private boolean mControlVisible = false;
+
public ControlLayout(Context ctx) {
super(ctx);
}
@@ -41,7 +43,8 @@ public class ControlLayout extends FrameLayout
public void loadLayout(CustomControls controlLayout) {
mLayout = controlLayout;
removeAllViews();
- for (ControlData button : controlLayout.button) {
+ for (ControlData button : controlLayout.mControlDataList) {
+ button.isHideable = button.keycode != ControlData.SPECIALBTN_TOGGLECTRL && button.keycode != ControlData.SPECIALBTN_VIRTUALMOUSE;
addControlView(button);
}
@@ -49,7 +52,7 @@ public class ControlLayout extends FrameLayout
}
public void addControlButton(ControlData controlButton) {
- mLayout.button.add(controlButton);
+ mLayout.mControlDataList.add(controlButton);
addControlView(controlButton);
}
@@ -62,7 +65,7 @@ public class ControlLayout extends FrameLayout
}
public void removeControlButton(ControlButton controlButton) {
- mLayout.button.remove(controlButton.getProperties());
+ mLayout.mControlDataList.remove(controlButton.getProperties());
controlButton.setVisibility(View.GONE);
removeView(controlButton);
@@ -84,7 +87,7 @@ public class ControlLayout extends FrameLayout
mControlVisible = !mControlVisible;
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
- if (view instanceof ControlButton && ((ControlButton) view).getProperties().keycode != ControlData.SPECIALBTN_TOGGLECTRL) {
+ if (view instanceof ControlButton && ((ControlButton) view).getProperties().isHideable) {
((ControlButton) view).setVisibility(mControlVisible ? (((ControlButton) view).getProperties().hidden ? View.INVISIBLE : View.VISIBLE) : View.GONE);
}
}
@@ -97,7 +100,9 @@ public class ControlLayout extends FrameLayout
if (v instanceof ControlButton) {
ControlButton cv = ((ControlButton) v);
cv.setModifiable(z);
- // cv.setVisibility(cv.getProperties().hidden ? View.INVISIBLE : View.VISIBLE);
+ if (!z) {
+ cv.setAlpha(cv.getProperties().hidden ? 0f : 1.0f);
+ }
}
}
}
diff --git a/app/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java b/app/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java
index c1d4f5d3f..ca1e9716b 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java
@@ -7,39 +7,48 @@ import org.lwjgl.glfw.*;
public class CustomControls
{
- public List button;
+ public List mControlDataList;
public CustomControls() {
this(new ArrayList());
}
- public CustomControls(List button) {
- this.button = button;
+ public CustomControls(List mControlDataList) {
+ this.mControlDataList = mControlDataList;
}
// Generate default control
public CustomControls(Context ctx) {
this();
- this.button.add(ControlData.getSpecialButtons()[0].clone()); // Keyboard
- this.button.add(ControlData.getSpecialButtons()[1].clone()); // GUI
- this.button.add(ControlData.getSpecialButtons()[2].clone()); // Primary Mouse button
- this.button.add(ControlData.getSpecialButtons()[3].clone()); // Secondary Mouse button
- this.button.add(ControlData.getSpecialButtons()[4].clone()); // Virtual mouse toggle
+ this.mControlDataList.add(ControlData.getSpecialButtons()[0].clone()); // Keyboard
+ this.mControlDataList.add(ControlData.getSpecialButtons()[1].clone()); // GUI
+ this.mControlDataList.add(ControlData.getSpecialButtons()[2].clone()); // Primary Mouse mControlDataList
+ this.mControlDataList.add(ControlData.getSpecialButtons()[3].clone()); // Secondary Mouse mControlDataList
+ this.mControlDataList.add(ControlData.getSpecialButtons()[4].clone()); // Virtual mouse toggle
- this.button.add(new ControlData(ctx, R.string.control_debug, LWJGLGLFWKeycode.GLFW_KEY_F3, "${margin}", "${margin}", false));
- this.button.add(new ControlData(ctx, R.string.control_chat, LWJGLGLFWKeycode.GLFW_KEY_T, "${margin} * 2 + ${width}", "${margin}", false));
- this.button.add(new ControlData(ctx, R.string.control_listplayers, LWJGLGLFWKeycode.GLFW_KEY_TAB, "${margin} * 4 + ${width} * 3", "${margin}", false));
- this.button.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_debug, LWJGLGLFWKeycode.GLFW_KEY_F3, "${margin}", "${margin}", false));
+ this.mControlDataList.add(new ControlData(ctx, R.string.control_chat, LWJGLGLFWKeycode.GLFW_KEY_T, "${margin} * 2 + ${width}", "${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.button.add(new ControlData(ctx, R.string.control_up, LWJGLGLFWKeycode.GLFW_KEY_W, "${margin} * 2 + ${width}", "${screen_height} - ${margin} * 3 - ${height} * 3", true));
- this.button.add(new ControlData(ctx, R.string.control_left, LWJGLGLFWKeycode.GLFW_KEY_A, "${margin}", "${screen_height} - ${margin} * 2 - ${height} * 2", true));
- this.button.add(new ControlData(ctx, R.string.control_down, LWJGLGLFWKeycode.GLFW_KEY_S, "${margin} * 2 + ${width}", "${screen_height} - ${margin} - ${width}", true));
- this.button.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_up, LWJGLGLFWKeycode.GLFW_KEY_W, "${margin} * 2 + ${width}", "${screen_height} - ${margin} * 3 - ${height} * 3", 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_down, LWJGLGLFWKeycode.GLFW_KEY_S, "${margin} * 2 + ${width}", "${screen_height} - ${margin} - ${width}", 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.button.add(new ControlData(ctx, R.string.control_inventory, LWJGLGLFWKeycode.GLFW_KEY_E, "${margin} * 3 + ${width} * 2", "${screen_height} - ${margin} - ${width}", true));
- this.button.add(new ControlData(ctx, R.string.control_shift, LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, "${margin} * 2 + ${width}", "${screen_height} - ${margin} * 2 - ${width} * 2", true));
- this.button.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_inventory, LWJGLGLFWKeycode.GLFW_KEY_E, "${margin} * 3 + ${width} * 2", "${screen_height} - ${margin} - ${width}", 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_jump, LWJGLGLFWKeycode.GLFW_KEY_SPACE, "${screen_width} - ${margin} * 3 - ${width} * 2", "${screen_height} - ${margin} * 2 - ${width} * 2", true));
}
+
+ public ControlData findControlData(int keycode) {
+ for (ControlData data : mControlDataList) {
+ if (data.keycode == keycode) {
+ return data;
+ }
+ }
+ return null;
+ }
public void save(String path) throws Exception {
Tools.write(path, Tools.GLOBAL_GSON.toJson(this));
diff --git a/app/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloaderTask.java b/app/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloaderTask.java
index dcba413d9..62b10f0ee 100644
--- a/app/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloaderTask.java
+++ b/app/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloaderTask.java
@@ -229,7 +229,7 @@ public class MinecraftDownloaderTask extends AsyncTask
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+