mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-21 09:01:56 -07:00
Add a pipe to send input event; Clean LWJGL2
This commit is contained in:
parent
fcfc4f16cb
commit
41e3207d38
27 changed files with 515 additions and 305 deletions
Binary file not shown.
|
|
@ -3,8 +3,6 @@ package net.kdt.pojavlaunch;
|
|||
import android.util.*;
|
||||
import android.view.*;
|
||||
import java.util.*;
|
||||
import org.lwjgl.input.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public class AndroidLWJGLKeycode {
|
||||
// Fix double letters on MC 1.9 and above
|
||||
|
|
@ -23,136 +21,137 @@ public class AndroidLWJGLKeycode {
|
|||
androidToLwjglMap = new ArrayMap<Integer, Integer>();
|
||||
|
||||
// 0-9 keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_0, Keyboard.KEY_0);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_1, Keyboard.KEY_1);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_2, Keyboard.KEY_2);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_3, Keyboard.KEY_3);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_4, Keyboard.KEY_4);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_5, Keyboard.KEY_5);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_6, Keyboard.KEY_6);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_7, Keyboard.KEY_7);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_8, Keyboard.KEY_8);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_9, Keyboard.KEY_9);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_0, LWJGLGLFWKeycode.GLFW_KEY_0);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_1, LWJGLGLFWKeycode.GLFW_KEY_1);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_2, LWJGLGLFWKeycode.GLFW_KEY_2);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_3, LWJGLGLFWKeycode.GLFW_KEY_3);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_4, LWJGLGLFWKeycode.GLFW_KEY_4);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_5, LWJGLGLFWKeycode.GLFW_KEY_5);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_6, LWJGLGLFWKeycode.GLFW_KEY_6);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_7, LWJGLGLFWKeycode.GLFW_KEY_7);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_8, LWJGLGLFWKeycode.GLFW_KEY_8);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_9, LWJGLGLFWKeycode.GLFW_KEY_9);
|
||||
|
||||
// A-Z keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_A, Keyboard.KEY_A);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_B, Keyboard.KEY_B);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_C, Keyboard.KEY_C);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_D, Keyboard.KEY_D);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_E, Keyboard.KEY_E);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F, Keyboard.KEY_F);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_G, Keyboard.KEY_G);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_H, Keyboard.KEY_H);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_I, Keyboard.KEY_I);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_J, Keyboard.KEY_J);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_K, Keyboard.KEY_K);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_L, Keyboard.KEY_L);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_M, Keyboard.KEY_M);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_N, Keyboard.KEY_M);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_O, Keyboard.KEY_O);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_P, Keyboard.KEY_P);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_Q, Keyboard.KEY_Q);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_R, Keyboard.KEY_R);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_S, Keyboard.KEY_S);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_T, Keyboard.KEY_T);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_U, Keyboard.KEY_U);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_V, Keyboard.KEY_V);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_W, Keyboard.KEY_W);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_X, Keyboard.KEY_X);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_Y, Keyboard.KEY_Y);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_Z, Keyboard.KEY_Z);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_A, LWJGLGLFWKeycode.GLFW_KEY_A);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_B, LWJGLGLFWKeycode.GLFW_KEY_B);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_C, LWJGLGLFWKeycode.GLFW_KEY_C);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_D, LWJGLGLFWKeycode.GLFW_KEY_D);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_E, LWJGLGLFWKeycode.GLFW_KEY_E);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F, LWJGLGLFWKeycode.GLFW_KEY_F);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_G, LWJGLGLFWKeycode.GLFW_KEY_G);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_H, LWJGLGLFWKeycode.GLFW_KEY_H);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_I, LWJGLGLFWKeycode.GLFW_KEY_I);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_J, LWJGLGLFWKeycode.GLFW_KEY_J);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_K, LWJGLGLFWKeycode.GLFW_KEY_K);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_L, LWJGLGLFWKeycode.GLFW_KEY_L);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_M, LWJGLGLFWKeycode.GLFW_KEY_M);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_N, LWJGLGLFWKeycode.GLFW_KEY_M);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_O, LWJGLGLFWKeycode.GLFW_KEY_O);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_P, LWJGLGLFWKeycode.GLFW_KEY_P);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_Q, LWJGLGLFWKeycode.GLFW_KEY_Q);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_R, LWJGLGLFWKeycode.GLFW_KEY_R);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_S, LWJGLGLFWKeycode.GLFW_KEY_S);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_T, LWJGLGLFWKeycode.GLFW_KEY_T);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_U, LWJGLGLFWKeycode.GLFW_KEY_U);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_V, LWJGLGLFWKeycode.GLFW_KEY_V);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_W, LWJGLGLFWKeycode.GLFW_KEY_W);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_X, LWJGLGLFWKeycode.GLFW_KEY_X);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_Y, LWJGLGLFWKeycode.GLFW_KEY_Y);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_Z, LWJGLGLFWKeycode.GLFW_KEY_Z);
|
||||
|
||||
// Alt keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ALT_LEFT, Keyboard.KEY_LMENU);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ALT_RIGHT, Keyboard.KEY_RMENU);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ALT_LEFT, LWJGLGLFWKeycode.GLFW_KEY_LEFT_ALT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ALT_RIGHT, LWJGLGLFWKeycode.GLFW_KEY_RIGHT_ALT);
|
||||
|
||||
// Escape key
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_BACK, Keyboard.KEY_ESCAPE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_BACK, LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
|
||||
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_BACKSLASH, Keyboard.KEY_BACKSLASH);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_BREAK, Keyboard.KEY_PAUSE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_CAPS_LOCK, Keyboard.KEY_CAPITAL);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_COMMA, Keyboard.KEY_COMMA);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_BACKSLASH, LWJGLGLFWKeycode.GLFW_KEY_BACKSLASH);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_BREAK, LWJGLGLFWKeycode.GLFW_KEY_PAUSE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_CAPS_LOCK, LWJGLGLFWKeycode.GLFW_KEY_CAPS_LOCK);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_COMMA, LWJGLGLFWKeycode.GLFW_KEY_COMMA);
|
||||
|
||||
// Control keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_CTRL_LEFT, Keyboard.KEY_LCONTROL);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_CTRL_RIGHT, Keyboard.KEY_RCONTROL);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_CTRL_LEFT, LWJGLGLFWKeycode.GLFW_KEY_LEFT_CONTROL);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_CTRL_RIGHT, LWJGLGLFWKeycode.GLFW_KEY_RIGHT_CONTROL);
|
||||
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DEL, Keyboard.KEY_BACK); // Backspace
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DEL, LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE); // Backspace
|
||||
|
||||
// Arrow keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_DOWN, Keyboard.KEY_DOWN);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_LEFT, Keyboard.KEY_LEFT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, Keyboard.KEY_RIGHT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_UP, Keyboard.KEY_UP);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_DOWN, LWJGLGLFWKeycode.GLFW_KEY_DOWN);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_LEFT, LWJGLGLFWKeycode.GLFW_KEY_LEFT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, LWJGLGLFWKeycode.GLFW_KEY_RIGHT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_DPAD_UP, LWJGLGLFWKeycode.GLFW_KEY_UP);
|
||||
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ENTER, Keyboard.KEY_RETURN);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_EQUALS, Keyboard.KEY_EQUALS);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ESCAPE, Keyboard.KEY_ESCAPE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ENTER, LWJGLGLFWKeycode.GLFW_KEY_ENTER);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_EQUALS, LWJGLGLFWKeycode.GLFW_KEY_EQUAL);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_ESCAPE, LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
|
||||
|
||||
// Fn keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F1, Keyboard.KEY_F1);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F2, Keyboard.KEY_F2);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F3, Keyboard.KEY_F3);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F4, Keyboard.KEY_F4);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F5, Keyboard.KEY_F5);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F6, Keyboard.KEY_F6);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F7, Keyboard.KEY_F7);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F8, Keyboard.KEY_F8);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F9, Keyboard.KEY_F9);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F10, Keyboard.KEY_F10);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F11, Keyboard.KEY_F11);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F12, Keyboard.KEY_F12);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_FUNCTION, Keyboard.KEY_FUNCTION);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F1, LWJGLGLFWKeycode.GLFW_KEY_F1);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F2, LWJGLGLFWKeycode.GLFW_KEY_F2);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F3, LWJGLGLFWKeycode.GLFW_KEY_F3);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F4, LWJGLGLFWKeycode.GLFW_KEY_F4);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F5, LWJGLGLFWKeycode.GLFW_KEY_F5);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F6, LWJGLGLFWKeycode.GLFW_KEY_F6);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F7, LWJGLGLFWKeycode.GLFW_KEY_F7);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F8, LWJGLGLFWKeycode.GLFW_KEY_F8);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F9, LWJGLGLFWKeycode.GLFW_KEY_F9);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F10, LWJGLGLFWKeycode.GLFW_KEY_F10);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F11, LWJGLGLFWKeycode.GLFW_KEY_F11);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_F12, LWJGLGLFWKeycode.GLFW_KEY_F12);
|
||||
// FIXME GLFW Function key
|
||||
// androidToLwjglMap.put(KeyEvent.KEYCODE_FUNCTION, LWJGLGLFWKeycode.GLFW_KEY_FUNCTION);
|
||||
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_GRAVE, Keyboard.KEY_GRAVE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_HOME, Keyboard.KEY_HOME);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_INSERT, Keyboard.KEY_INSERT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_KANA, Keyboard.KEY_KANA);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_LEFT_BRACKET, Keyboard.KEY_LBRACKET);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_MINUS, Keyboard.KEY_MINUS);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_GRAVE, LWJGLGLFWKeycode.GLFW_KEY_GRAVE_ACCENT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_HOME, LWJGLGLFWKeycode.GLFW_KEY_HOME);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_INSERT, LWJGLGLFWKeycode.GLFW_KEY_INSERT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_KANA, LWJGLGLFWKeycode.GLFW_KEY_K);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_LEFT_BRACKET, LWJGLGLFWKeycode.GLFW_KEY_LEFT_BRACKET);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_MINUS, LWJGLGLFWKeycode.GLFW_KEY_MINUS);
|
||||
|
||||
// Num keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUM_LOCK, Keyboard.KEY_NUMLOCK);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_0, Keyboard.KEY_NUMPAD0);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_1, Keyboard.KEY_NUMPAD1);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_2, Keyboard.KEY_NUMPAD2);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_3, Keyboard.KEY_NUMPAD3);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_4, Keyboard.KEY_NUMPAD4);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_5, Keyboard.KEY_NUMPAD5);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_6, Keyboard.KEY_NUMPAD6);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_7, Keyboard.KEY_NUMPAD7);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_8, Keyboard.KEY_NUMPAD8);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_9, Keyboard.KEY_NUMPAD9);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_ADD, Keyboard.KEY_ADD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_COMMA, Keyboard.KEY_NUMPADCOMMA);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_DIVIDE, Keyboard.KEY_DIVIDE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_DOT, Keyboard.KEY_PERIOD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, Keyboard.KEY_NUMPADENTER);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_EQUALS, Keyboard.KEY_NUMPADEQUALS);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_MULTIPLY, Keyboard.KEY_MULTIPLY);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_SUBTRACT, Keyboard.KEY_SUBTRACT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUM_LOCK, LWJGLGLFWKeycode.GLFW_KEY_NUM_LOCK);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_0, LWJGLGLFWKeycode.GLFW_KEY_0);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_1, LWJGLGLFWKeycode.GLFW_KEY_1);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_2, LWJGLGLFWKeycode.GLFW_KEY_2);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_3, LWJGLGLFWKeycode.GLFW_KEY_3);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_4, LWJGLGLFWKeycode.GLFW_KEY_4);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_5, LWJGLGLFWKeycode.GLFW_KEY_5);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_6, LWJGLGLFWKeycode.GLFW_KEY_6);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_7, LWJGLGLFWKeycode.GLFW_KEY_7);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_8, LWJGLGLFWKeycode.GLFW_KEY_8);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_9, LWJGLGLFWKeycode.GLFW_KEY_9);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_ADD, LWJGLGLFWKeycode.GLFW_KEY_KP_ADD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_COMMA, LWJGLGLFWKeycode.GLFW_KEY_COMMA);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_DIVIDE, LWJGLGLFWKeycode.GLFW_KEY_KP_DIVIDE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_DOT, LWJGLGLFWKeycode.GLFW_KEY_PERIOD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, LWJGLGLFWKeycode.GLFW_KEY_ENTER);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_EQUALS, LWJGLGLFWKeycode.GLFW_KEY_EQUAL);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_MULTIPLY, LWJGLGLFWKeycode.GLFW_KEY_KP_MULTIPLY);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_NUMPAD_SUBTRACT, LWJGLGLFWKeycode.GLFW_KEY_KP_SUBTRACT);
|
||||
|
||||
// Page keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PAGE_DOWN, Keyboard.KEY_NEXT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PAGE_UP, Keyboard.KEY_PRIOR);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PAGE_DOWN, LWJGLGLFWKeycode.GLFW_KEY_PAGE_DOWN);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PAGE_UP, LWJGLGLFWKeycode.GLFW_KEY_PAGE_UP);
|
||||
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PERIOD, Keyboard.KEY_PERIOD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PLUS, Keyboard.KEY_ADD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_POWER, Keyboard.KEY_POWER);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_RIGHT_BRACKET, Keyboard.KEY_RBRACKET);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SEMICOLON, Keyboard.KEY_SEMICOLON);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PERIOD, LWJGLGLFWKeycode.GLFW_KEY_PERIOD);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_PLUS, LWJGLGLFWKeycode.GLFW_KEY_KP_ADD);
|
||||
// androidToLwjglMap.put(KeyEvent.KEYCODE_POWER, LWJGLGLFWKeycode.GLFW_KEY_POWER);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_RIGHT_BRACKET, LWJGLGLFWKeycode.GLFW_KEY_RIGHT_BRACKET);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SEMICOLON, LWJGLGLFWKeycode.GLFW_KEY_SEMICOLON);
|
||||
|
||||
// Shift keys
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SHIFT_LEFT, Keyboard.KEY_LSHIFT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SHIFT_RIGHT, Keyboard.KEY_RSHIFT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SHIFT_LEFT, LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SHIFT_RIGHT, LWJGLGLFWKeycode.GLFW_KEY_RIGHT_SHIFT);
|
||||
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SLASH, Keyboard.KEY_SLASH);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SLEEP, Keyboard.KEY_SLEEP);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SPACE, Keyboard.KEY_SPACE);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SYSRQ, Keyboard.KEY_SYSRQ);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_TAB, Keyboard.KEY_TAB);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_YEN, Keyboard.KEY_YEN);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SLASH, LWJGLGLFWKeycode.GLFW_KEY_SLASH);
|
||||
// androidToLwjglMap.put(KeyEvent.KEYCODE_SLEEP, LWJGLGLFWKeycode.GLFW_KEY_SLEEP);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_SPACE, LWJGLGLFWKeycode.GLFW_KEY_SPACE);
|
||||
// androidToLwjglMap.put(KeyEvent.KEYCODE_SYSRQ, LWJGLGLFWKeycode.GLFW_KEY_SYSRQ);
|
||||
androidToLwjglMap.put(KeyEvent.KEYCODE_TAB, LWJGLGLFWKeycode.GLFW_KEY_TAB);
|
||||
// androidToLwjglMap.put(KeyEvent.KEYCODE_YEN, LWJGLGLFWKeycode.GLFW_KEY_YEN);
|
||||
}
|
||||
|
||||
public static String[] generateKeyName() {
|
||||
|
|
@ -180,25 +179,25 @@ public class AndroidLWJGLKeycode {
|
|||
}
|
||||
|
||||
if (keyEvent.isAltPressed()) {
|
||||
mainActivity.sendKeyPress(Keyboard.KEY_LMENU, isDown);
|
||||
mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_ALT, isDown);
|
||||
} if (keyEvent.isCtrlPressed()) {
|
||||
mainActivity.sendKeyPress(Keyboard.KEY_LCONTROL, isDown);
|
||||
mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_CONTROL, isDown);
|
||||
} if (keyEvent.isFunctionPressed()) {
|
||||
mainActivity.sendKeyPress(Keyboard.KEY_FUNCTION, isDown);
|
||||
// mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_FUNCTION, isDown);
|
||||
} if (keyEvent.isShiftPressed()) {
|
||||
mainActivity.sendKeyPress(Keyboard.KEY_LSHIFT, isDown);
|
||||
mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, isDown);
|
||||
}
|
||||
|
||||
try {
|
||||
if (/* (int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && */ !AndroidDisplay.grab) {
|
||||
if (/* (int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && */ !LWJGLInputSender.isGrabbing()) {
|
||||
mainActivity.sendKeyPress(0, (char) keyEvent.getUnicodeChar(), isDown);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
|
||||
if (isBackspaceAfterChar && !AndroidDisplay.grab && i != KeyEvent.KEYCODE_DEL) {
|
||||
mainActivity.sendKeyPress(Keyboard.KEY_BACK, isDown);
|
||||
if (isBackspaceAfterChar && !LWJGLInputSender.isGrabbing() && i != KeyEvent.KEYCODE_DEL) {
|
||||
mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, isDown);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import com.kdt.filerapi.*;
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import org.lwjgl.input.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import android.support.v7.preference.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
|
||||
|
|
@ -55,7 +53,7 @@ public class CustomControlsActivity extends AppCompatActivity
|
|||
actionLoad();
|
||||
break;
|
||||
case R.id.menu_ctrl_add:
|
||||
ctrlLayout.addControlButton(new ControlButton("New", Keyboard.CHAR_NONE, 100, 100));
|
||||
ctrlLayout.addControlButton(new ControlButton("New", LWJGLGLFWKeycode.GLFW_KEY_UNKNOWN, 100, 100));
|
||||
break;
|
||||
case R.id.menu_ctrl_selectdefault:
|
||||
dialogSelectDefaultCtrl();
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ package net.kdt.pojavlaunch;
|
|||
import android.text.method.*;
|
||||
import android.view.*;
|
||||
import android.view.inputmethod.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.lwjgl.input.*;
|
||||
|
||||
|
||||
public class DroidToJavaKey {
|
||||
private static StringBuilder mComposing = new StringBuilder();
|
||||
|
|
|
|||
169
app/src/main/java/net/kdt/pojavlaunch/LWJGLGLFWKeycode.java
Normal file
169
app/src/main/java/net/kdt/pojavlaunch/LWJGLGLFWKeycode.java
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
package net.kdt.pojavlaunch;
|
||||
|
||||
public class LWJGLGLFWKeycode
|
||||
{
|
||||
/** The unknown key. */
|
||||
public static final int GLFW_KEY_UNKNOWN = -1;
|
||||
|
||||
/** Printable keys. */
|
||||
public static final int
|
||||
GLFW_KEY_SPACE = 32,
|
||||
GLFW_KEY_APOSTROPHE = 39,
|
||||
GLFW_KEY_COMMA = 44,
|
||||
GLFW_KEY_MINUS = 45,
|
||||
GLFW_KEY_PERIOD = 46,
|
||||
GLFW_KEY_SLASH = 47,
|
||||
GLFW_KEY_0 = 48,
|
||||
GLFW_KEY_1 = 49,
|
||||
GLFW_KEY_2 = 50,
|
||||
GLFW_KEY_3 = 51,
|
||||
GLFW_KEY_4 = 52,
|
||||
GLFW_KEY_5 = 53,
|
||||
GLFW_KEY_6 = 54,
|
||||
GLFW_KEY_7 = 55,
|
||||
GLFW_KEY_8 = 56,
|
||||
GLFW_KEY_9 = 57,
|
||||
GLFW_KEY_SEMICOLON = 59,
|
||||
GLFW_KEY_EQUAL = 61,
|
||||
GLFW_KEY_A = 65,
|
||||
GLFW_KEY_B = 66,
|
||||
GLFW_KEY_C = 67,
|
||||
GLFW_KEY_D = 68,
|
||||
GLFW_KEY_E = 69,
|
||||
GLFW_KEY_F = 70,
|
||||
GLFW_KEY_G = 71,
|
||||
GLFW_KEY_H = 72,
|
||||
GLFW_KEY_I = 73,
|
||||
GLFW_KEY_J = 74,
|
||||
GLFW_KEY_K = 75,
|
||||
GLFW_KEY_L = 76,
|
||||
GLFW_KEY_M = 77,
|
||||
GLFW_KEY_N = 78,
|
||||
GLFW_KEY_O = 79,
|
||||
GLFW_KEY_P = 80,
|
||||
GLFW_KEY_Q = 81,
|
||||
GLFW_KEY_R = 82,
|
||||
GLFW_KEY_S = 83,
|
||||
GLFW_KEY_T = 84,
|
||||
GLFW_KEY_U = 85,
|
||||
GLFW_KEY_V = 86,
|
||||
GLFW_KEY_W = 87,
|
||||
GLFW_KEY_X = 88,
|
||||
GLFW_KEY_Y = 89,
|
||||
GLFW_KEY_Z = 90,
|
||||
GLFW_KEY_LEFT_BRACKET = 91,
|
||||
GLFW_KEY_BACKSLASH = 92,
|
||||
GLFW_KEY_RIGHT_BRACKET = 93,
|
||||
GLFW_KEY_GRAVE_ACCENT = 96,
|
||||
GLFW_KEY_WORLD_1 = 161,
|
||||
GLFW_KEY_WORLD_2 = 162;
|
||||
|
||||
/** Function keys. */
|
||||
public static final int
|
||||
GLFW_KEY_ESCAPE = 256,
|
||||
GLFW_KEY_ENTER = 257,
|
||||
GLFW_KEY_TAB = 258,
|
||||
GLFW_KEY_BACKSPACE = 259,
|
||||
GLFW_KEY_INSERT = 260,
|
||||
GLFW_KEY_DELETE = 261,
|
||||
GLFW_KEY_RIGHT = 262,
|
||||
GLFW_KEY_LEFT = 263,
|
||||
GLFW_KEY_DOWN = 264,
|
||||
GLFW_KEY_UP = 265,
|
||||
GLFW_KEY_PAGE_UP = 266,
|
||||
GLFW_KEY_PAGE_DOWN = 267,
|
||||
GLFW_KEY_HOME = 268,
|
||||
GLFW_KEY_END = 269,
|
||||
GLFW_KEY_CAPS_LOCK = 280,
|
||||
GLFW_KEY_SCROLL_LOCK = 281,
|
||||
GLFW_KEY_NUM_LOCK = 282,
|
||||
GLFW_KEY_PRINT_SCREEN = 283,
|
||||
GLFW_KEY_PAUSE = 284,
|
||||
GLFW_KEY_F1 = 290,
|
||||
GLFW_KEY_F2 = 291,
|
||||
GLFW_KEY_F3 = 292,
|
||||
GLFW_KEY_F4 = 293,
|
||||
GLFW_KEY_F5 = 294,
|
||||
GLFW_KEY_F6 = 295,
|
||||
GLFW_KEY_F7 = 296,
|
||||
GLFW_KEY_F8 = 297,
|
||||
GLFW_KEY_F9 = 298,
|
||||
GLFW_KEY_F10 = 299,
|
||||
GLFW_KEY_F11 = 300,
|
||||
GLFW_KEY_F12 = 301,
|
||||
GLFW_KEY_F13 = 302,
|
||||
GLFW_KEY_F14 = 303,
|
||||
GLFW_KEY_F15 = 304,
|
||||
GLFW_KEY_F16 = 305,
|
||||
GLFW_KEY_F17 = 306,
|
||||
GLFW_KEY_F18 = 307,
|
||||
GLFW_KEY_F19 = 308,
|
||||
GLFW_KEY_F20 = 309,
|
||||
GLFW_KEY_F21 = 310,
|
||||
GLFW_KEY_F22 = 311,
|
||||
GLFW_KEY_F23 = 312,
|
||||
GLFW_KEY_F24 = 313,
|
||||
GLFW_KEY_F25 = 314,
|
||||
GLFW_KEY_KP_0 = 320,
|
||||
GLFW_KEY_KP_1 = 321,
|
||||
GLFW_KEY_KP_2 = 322,
|
||||
GLFW_KEY_KP_3 = 323,
|
||||
GLFW_KEY_KP_4 = 324,
|
||||
GLFW_KEY_KP_5 = 325,
|
||||
GLFW_KEY_KP_6 = 326,
|
||||
GLFW_KEY_KP_7 = 327,
|
||||
GLFW_KEY_KP_8 = 328,
|
||||
GLFW_KEY_KP_9 = 329,
|
||||
GLFW_KEY_KP_DECIMAL = 330,
|
||||
GLFW_KEY_KP_DIVIDE = 331,
|
||||
GLFW_KEY_KP_MULTIPLY = 332,
|
||||
GLFW_KEY_KP_SUBTRACT = 333,
|
||||
GLFW_KEY_KP_ADD = 334,
|
||||
GLFW_KEY_KP_ENTER = 335,
|
||||
GLFW_KEY_KP_EQUAL = 336,
|
||||
GLFW_KEY_LEFT_SHIFT = 340,
|
||||
GLFW_KEY_LEFT_CONTROL = 341,
|
||||
GLFW_KEY_LEFT_ALT = 342,
|
||||
GLFW_KEY_LEFT_SUPER = 343,
|
||||
GLFW_KEY_RIGHT_SHIFT = 344,
|
||||
GLFW_KEY_RIGHT_CONTROL = 345,
|
||||
GLFW_KEY_RIGHT_ALT = 346,
|
||||
GLFW_KEY_RIGHT_SUPER = 347,
|
||||
GLFW_KEY_MENU = 348,
|
||||
GLFW_KEY_LAST = GLFW_KEY_MENU;
|
||||
|
||||
/** If this bit is set one or more Shift keys were held down. */
|
||||
public static final int GLFW_MOD_SHIFT = 0x1;
|
||||
|
||||
/** If this bit is set one or more Control keys were held down. */
|
||||
public static final int GLFW_MOD_CONTROL = 0x2;
|
||||
|
||||
/** If this bit is set one or more Alt keys were held down. */
|
||||
public static final int GLFW_MOD_ALT = 0x4;
|
||||
|
||||
/** If this bit is set one or more Super keys were held down. */
|
||||
public static final int GLFW_MOD_SUPER = 0x8;
|
||||
|
||||
/** If this bit is set the Caps Lock key is enabled and the {@link #GLFW_LOCK_KEY_MODS LOCK_KEY_MODS} input mode is set. */
|
||||
public static final int GLFW_MOD_CAPS_LOCK = 0x10;
|
||||
|
||||
/** If this bit is set the Num Lock key is enabled and the {@link #GLFW_LOCK_KEY_MODS LOCK_KEY_MODS} input mode is set. */
|
||||
public static final int GLFW_MOD_NUM_LOCK = 0x20;
|
||||
|
||||
|
||||
/** Mouse buttons. See <a target="_blank" href="http://www.glfw.org/docs/latest/input.html#input_mouse_button">mouse button input</a> for how these are used. */
|
||||
public static final int
|
||||
GLFW_MOUSE_BUTTON_1 = 0,
|
||||
GLFW_MOUSE_BUTTON_2 = 1,
|
||||
GLFW_MOUSE_BUTTON_3 = 2,
|
||||
GLFW_MOUSE_BUTTON_4 = 3,
|
||||
GLFW_MOUSE_BUTTON_5 = 4,
|
||||
GLFW_MOUSE_BUTTON_6 = 5,
|
||||
GLFW_MOUSE_BUTTON_7 = 6,
|
||||
GLFW_MOUSE_BUTTON_8 = 7,
|
||||
GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8,
|
||||
GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1,
|
||||
GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2,
|
||||
GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3;
|
||||
|
||||
}
|
||||
45
app/src/main/java/net/kdt/pojavlaunch/LWJGLInputSender.java
Normal file
45
app/src/main/java/net/kdt/pojavlaunch/LWJGLInputSender.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package net.kdt.pojavlaunch;
|
||||
|
||||
public class LWJGLInputSender
|
||||
{
|
||||
public static final int TYPE_CURSOR_POS = 0;
|
||||
public static final int TYPE_CURSOR_BUTTON = 2;
|
||||
public static final int TYPE_KEYCODE_CONTROL = 3;
|
||||
public static final int TYPE_KEYCODE_CHAR = 4;
|
||||
public static final int TYPE_MOUSE_KEYCODE_CONTROL = 3;
|
||||
public static final int TYPE_WINDOW_SIZE = 5;
|
||||
|
||||
public static int windowWidth, windowHeight;
|
||||
public static int mouseX, mouseY;
|
||||
public static boolean mouseLeft;
|
||||
|
||||
public static void sendCursorPos(int x, int y) {
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
sendDataToJRE(TYPE_CURSOR_POS, x + ":" + y);
|
||||
}
|
||||
|
||||
public static void sendKeycode(int keycode, boolean isDown) {
|
||||
sendDataToJRE(TYPE_KEYCODE_CONTROL, keycode + ":" + Boolean.toString(isDown));
|
||||
}
|
||||
|
||||
public static void sendMouseKeycode(int keycode, boolean isDown) {
|
||||
sendDataToJRE(TYPE_MOUSE_KEYCODE_CONTROL, keycode + ":" + Boolean.toString(isDown));
|
||||
}
|
||||
|
||||
public static void sendMouseKeycode(int keycode) {
|
||||
sendMouseKeycode(keycode, true);
|
||||
sendMouseKeycode(keycode, false);
|
||||
}
|
||||
|
||||
public static void sendUpdateWindowSize(int w, int h) {
|
||||
sendDataToJRE(TYPE_WINDOW_SIZE, w + ":" + h);
|
||||
}
|
||||
|
||||
public static boolean isGrabbing() {
|
||||
// TODO implement this method!!!
|
||||
return false;
|
||||
}
|
||||
|
||||
public static native void sendDataToJRE(int type, String data);
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ import net.kdt.pojavlaunch.prefs.*;
|
|||
import net.kdt.pojavlaunch.signer.*;
|
||||
import net.kdt.pojavlaunch.util.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
|
@ -69,8 +68,8 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||
gson = new Gson();
|
||||
|
||||
DisplayMetrics dm = Tools.getDisplayMetrics(this);
|
||||
AndroidDisplay.windowWidth = dm.widthPixels;
|
||||
AndroidDisplay.windowHeight = dm.heightPixels;
|
||||
LWJGLInputSender.windowWidth = dm.widthPixels;
|
||||
LWJGLInputSender.windowHeight = dm.heightPixels;
|
||||
viewInit();
|
||||
|
||||
final View decorView = getWindow().getDecorView();
|
||||
|
|
@ -258,10 +257,10 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||
}
|
||||
|
||||
private float updateWidthHeight() {
|
||||
float leftRightWidth = (float) AndroidDisplay.windowWidth / 100f * 32f;
|
||||
float playButtonWidth = AndroidDisplay.windowWidth - leftRightWidth * 2f;
|
||||
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth, (int) Tools.dpToPx(this, AndroidDisplay.windowHeight / 9));
|
||||
LinearLayout.LayoutParams playButtonParams = new LinearLayout.LayoutParams((int) playButtonWidth, (int) Tools.dpToPx(this, AndroidDisplay.windowHeight / 9));
|
||||
float leftRightWidth = (float) LWJGLInputSender.windowWidth / 100f * 32f;
|
||||
float playButtonWidth = LWJGLInputSender.windowWidth - leftRightWidth * 2f;
|
||||
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth, (int) Tools.dpToPx(this, LWJGLInputSender.windowHeight / 9));
|
||||
LinearLayout.LayoutParams playButtonParams = new LinearLayout.LayoutParams((int) playButtonWidth, (int) Tools.dpToPx(this, LWJGLInputSender.windowHeight / 9));
|
||||
leftView.setLayoutParams(leftRightParams);
|
||||
rightView.setLayoutParams(leftRightParams);
|
||||
playButton.setLayoutParams(playButtonParams);
|
||||
|
|
@ -775,7 +774,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||
aboutB.setMessage(String.format(Tools.read(getAssets().open("about_en.txt")),
|
||||
Tools.APP_NAME,
|
||||
Tools.usingVerName,
|
||||
org.lwjgl.Sys.getVersion())
|
||||
"3.2.3")
|
||||
);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ import javax.microedition.khronos.opengles.*;
|
|||
import net.kdt.pojavlaunch.exit.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import org.lwjgl.input.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import com.oracle.dalvik.*;
|
||||
|
|
@ -36,9 +34,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
public static final String initText = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ";
|
||||
|
||||
private static int[] hotbarKeys = {
|
||||
Keyboard.KEY_1, Keyboard.KEY_2, Keyboard.KEY_3,
|
||||
Keyboard.KEY_4, Keyboard.KEY_5, Keyboard.KEY_6,
|
||||
Keyboard.KEY_7, Keyboard.KEY_8, Keyboard.KEY_9};
|
||||
LWJGLGLFWKeycode.GLFW_KEY_1, LWJGLGLFWKeycode.GLFW_KEY_2, LWJGLGLFWKeycode.GLFW_KEY_3,
|
||||
LWJGLGLFWKeycode.GLFW_KEY_4, LWJGLGLFWKeycode.GLFW_KEY_5, LWJGLGLFWKeycode.GLFW_KEY_6,
|
||||
LWJGLGLFWKeycode.GLFW_KEY_7, LWJGLGLFWKeycode.GLFW_KEY_8, LWJGLGLFWKeycode.GLFW_KEY_9};
|
||||
|
||||
private boolean rightOverride = false;
|
||||
private int scaleFactor = 1;
|
||||
|
|
@ -53,9 +51,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_LEFT_MOUSE_BUTTON_CHECK: {
|
||||
int x = AndroidDisplay.mouseX;
|
||||
int y = AndroidDisplay.mouseY;
|
||||
if (AndroidDisplay.grab &&
|
||||
int x = LWJGLInputSender.mouseX;
|
||||
int y = LWJGLInputSender.mouseY;
|
||||
if (LWJGLInputSender.isGrabbing() &&
|
||||
Math.abs(initialX - x) < fingerStillThreshold &&
|
||||
Math.abs(initialY - y) < fingerStillThreshold) {
|
||||
triggeredLeftMouseButton = true;
|
||||
|
|
@ -63,7 +61,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
} break;
|
||||
case MSG_DROP_ITEM_BUTTON_CHECK: {
|
||||
sendKeyPress(Keyboard.KEY_Q, true);
|
||||
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_Q, true);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -179,9 +177,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
|
||||
this.displayMetrics = Tools.getDisplayMetrics(this);
|
||||
|
||||
AndroidDisplay.windowWidth = displayMetrics.widthPixels / scaleFactor;
|
||||
AndroidDisplay.windowHeight = displayMetrics.heightPixels / scaleFactor;
|
||||
System.out.println("WidthHeight: " + AndroidDisplay.windowWidth + ":" + AndroidDisplay.windowHeight);
|
||||
LWJGLInputSender.windowWidth = displayMetrics.widthPixels / scaleFactor;
|
||||
LWJGLInputSender.windowHeight = displayMetrics.heightPixels / scaleFactor;
|
||||
System.out.println("WidthHeight: " + LWJGLInputSender.windowWidth + ":" + LWJGLInputSender.windowHeight);
|
||||
|
||||
gestureDetector = new GestureDetector(this, new SingleTapConfirm());
|
||||
|
||||
|
|
@ -287,7 +285,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
|
||||
AndroidLWJGLKeycode.isBackspaceAfterChar = mVersionInfo.minimumLauncherVersion >= 18;
|
||||
|
||||
placeMouseAt(AndroidDisplay.windowWidth / 2, AndroidDisplay.windowHeight / 2);
|
||||
placeMouseAt(LWJGLInputSender.windowWidth / 2, LWJGLInputSender.windowHeight / 2);
|
||||
new Thread(new Runnable(){
|
||||
|
||||
private boolean isCapturing = false;
|
||||
|
|
@ -300,29 +298,29 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (lastGrab && !AndroidDisplay.grab && lastEnabled) {
|
||||
if (lastGrab && !LWJGLInputSender.isGrabbing() && lastEnabled) {
|
||||
touchPad.setVisibility(View.VISIBLE);
|
||||
placeMouseAt(AndroidDisplay.windowWidth / 2, AndroidDisplay.windowHeight / 2);
|
||||
placeMouseAt(LWJGLInputSender.windowWidth / 2, LWJGLInputSender.windowHeight / 2);
|
||||
}
|
||||
|
||||
if (!AndroidDisplay.grab) {
|
||||
if (!LWJGLInputSender.isGrabbing()) {
|
||||
lastEnabled = touchPad.getVisibility() == View.VISIBLE;
|
||||
} else if (touchPad.getVisibility() != View.GONE) {
|
||||
touchPad.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (isPointerCaptureSupported()) {
|
||||
if (!AndroidDisplay.grab && isCapturing) {
|
||||
if (!LWJGLInputSender.isGrabbing() && isCapturing) {
|
||||
pointerSurface.releaseCapture(); // minecraftGLView.releasePointerCapture();
|
||||
isCapturing = false;
|
||||
} else if (AndroidDisplay.grab && !isCapturing) {
|
||||
} else if (LWJGLInputSender.isGrabbing() && !isCapturing) {
|
||||
minecraftGLView.requestFocus();
|
||||
pointerSurface.requestCapture(); // minecraftGLView.requestPointerCapture();
|
||||
isCapturing = true;
|
||||
}
|
||||
}
|
||||
|
||||
lastGrab = AndroidDisplay.grab;
|
||||
lastGrab = LWJGLInputSender.isGrabbing();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -351,10 +349,11 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
float mouseY = mousePointer.getTranslationY();
|
||||
|
||||
if (gestureDetector.onTouchEvent(event)) {
|
||||
AndroidDisplay.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, (int) mouseX, (int) (AndroidDisplay.windowHeight - mouseY), 0, System.nanoTime());
|
||||
AndroidDisplay.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, (int) mouseX, (int) (AndroidDisplay.windowHeight - mouseY), 0, System.nanoTime());
|
||||
|
||||
LWJGLInputSender.sendCursorPos((int) mouseX, (int) (LWJGLInputSender.windowHeight - mouseY));
|
||||
LWJGLInputSender.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT);
|
||||
if (!rightOverride) {
|
||||
AndroidDisplay.mouseLeft = true;
|
||||
LWJGLInputSender.mouseLeft = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -363,7 +362,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
case MotionEvent.ACTION_CANCEL: // 3
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
if (!rightOverride) {
|
||||
AndroidDisplay.mouseLeft = false;
|
||||
LWJGLInputSender.mouseLeft = false;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE: // 2
|
||||
|
|
@ -372,18 +371,17 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
mouseY += y - prevY;
|
||||
if (mouseX <= 0) {
|
||||
mouseX = 0;
|
||||
} else if (mouseX >= AndroidDisplay.windowWidth) {
|
||||
mouseX = AndroidDisplay.windowWidth;
|
||||
} else if (mouseX >= LWJGLInputSender.windowWidth) {
|
||||
mouseX = LWJGLInputSender.windowWidth;
|
||||
} if (mouseY <= 0) {
|
||||
mouseY = 0;
|
||||
} else if (mouseY >= AndroidDisplay.windowHeight) {
|
||||
mouseY = AndroidDisplay.windowHeight;
|
||||
} else if (mouseY >= LWJGLInputSender.windowHeight) {
|
||||
mouseY = LWJGLInputSender.windowHeight;
|
||||
}
|
||||
} finally {
|
||||
placeMouseAt(mouseX, mouseY);
|
||||
|
||||
AndroidDisplay.mouseX = (int) mouseX;
|
||||
AndroidDisplay.mouseY = AndroidDisplay.windowHeight - (int) mouseY;
|
||||
LWJGLInputSender.sendCursorPos((int) mouseX, LWJGLInputSender.windowHeight - (int) mouseY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -411,14 +409,14 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
int x = ((int) e.getX()) / scaleFactor;
|
||||
int y = (minecraftGLView.getHeight() - ((int) e.getY())) / scaleFactor;
|
||||
int hudKeyHandled = handleGuiBar(x, y, e);
|
||||
if (!AndroidDisplay.grab && gestureDetector.onTouchEvent(e)) {
|
||||
if (!LWJGLInputSender.isGrabbing() && gestureDetector.onTouchEvent(e)) {
|
||||
if (hudKeyHandled != -1) {
|
||||
sendKeyPress(hudKeyHandled);
|
||||
} else {
|
||||
AndroidDisplay.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime());
|
||||
AndroidDisplay.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
LWJGLInputSender.sendCursorPos(x, y);
|
||||
LWJGLInputSender.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT);
|
||||
if (!rightOverride) {
|
||||
AndroidDisplay.mouseLeft = true;
|
||||
LWJGLInputSender.mouseLeft = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -433,14 +431,13 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
|
||||
theHandler.sendEmptyMessageDelayed(MainActivity.MSG_DROP_ITEM_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
|
||||
} else {
|
||||
AndroidDisplay.mouseX = x;
|
||||
AndroidDisplay.mouseY = y;
|
||||
LWJGLInputSender.sendCursorPos(x, y);
|
||||
if (!rightOverride) {
|
||||
AndroidDisplay.mouseLeft = true;
|
||||
// LWJGLInputSender.mouseLeft = true;
|
||||
}
|
||||
|
||||
if (AndroidDisplay.grab) {
|
||||
AndroidDisplay.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime());
|
||||
if (LWJGLInputSender.isGrabbing()) {
|
||||
LWJGLInputSender.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, true);
|
||||
initialX = x;
|
||||
initialY = y;
|
||||
theHandler.sendEmptyMessageDelayed(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
|
||||
|
|
@ -451,17 +448,16 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
case MotionEvent.ACTION_CANCEL: // 3
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
if (!isTouchInHotbar) {
|
||||
AndroidDisplay.mouseX = x;
|
||||
AndroidDisplay.mouseY = y;
|
||||
LWJGLInputSender.sendCursorPos(x, y);
|
||||
|
||||
// TODO uncomment after fix wrong trigger
|
||||
// AndroidDisplay.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
// LWJGLInputSender.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
if (!rightOverride) {
|
||||
AndroidDisplay.mouseLeft = false;
|
||||
// LWJGLInputSender.mouseLeft = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (AndroidDisplay.grab) {
|
||||
if (LWJGLInputSender.isGrabbing()) {
|
||||
// System.out.println((String) ("[Math.abs(" + initialX + " - " + x + ") = " + Math.abs(initialX - x) + "] < " + fingerStillThreshold));
|
||||
// System.out.println((String) ("[Math.abs(" + initialY + " - " + y + ") = " + Math.abs(initialY - y) + "] < " + fingerStillThreshold));
|
||||
if (isTouchInHotbar && Math.abs(hotbarX - x) < fingerStillThreshold && Math.abs(hotbarY - y) < fingerStillThreshold) {
|
||||
|
|
@ -477,7 +473,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
triggeredLeftMouseButton = false;
|
||||
theHandler.removeMessages(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK);
|
||||
} else {
|
||||
sendKeyPress(Keyboard.KEY_Q, false);
|
||||
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_Q, false);
|
||||
theHandler.removeMessages(MSG_DROP_ITEM_BUTTON_CHECK);
|
||||
}
|
||||
}
|
||||
|
|
@ -485,15 +481,14 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
|
||||
default:
|
||||
if (!isTouchInHotbar) {
|
||||
AndroidDisplay.mouseX = x;
|
||||
AndroidDisplay.mouseY = y;
|
||||
LWJGLInputSender.sendCursorPos(x, y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
// return !AndroidDisplay.grab;
|
||||
// return !LWJGLInputSender.isGrabbing();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -542,24 +537,23 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
}
|
||||
|
||||
AndroidDisplay.mouseX = x;
|
||||
AndroidDisplay.mouseY = y;
|
||||
|
||||
LWJGLInputSender.sendCursorPos(x, y);
|
||||
|
||||
switch (e.getButtonState()) {
|
||||
case MotionEvent.BUTTON_PRIMARY: AndroidDisplay.mouseLeft = true;
|
||||
case MotionEvent.BUTTON_PRIMARY: LWJGLInputSender.mouseLeft = true;
|
||||
break;
|
||||
case MotionEvent.BUTTON_SECONDARY: AndroidDisplay.mouseLeft = false;
|
||||
case MotionEvent.BUTTON_SECONDARY: LWJGLInputSender.mouseLeft = false;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (e.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: // 0
|
||||
case MotionEvent.ACTION_POINTER_DOWN: // 5
|
||||
AndroidDisplay.putMouseEventWithCoords(!AndroidDisplay.mouseLeft /* rightOverride */ ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime());
|
||||
LWJGLInputSender.sendMouseKeycode(!LWJGLInputSender.mouseLeft ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, true);
|
||||
initialX = x;
|
||||
initialY = y;
|
||||
|
||||
sendMouseButton(AndroidDisplay.mouseLeft ? 0 : 1, false);
|
||||
sendMouseButton(LWJGLInputSender.mouseLeft ? 0 : 1, false);
|
||||
|
||||
// theHandler.sendEmptyMessageDelayed(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
|
||||
break;
|
||||
|
|
@ -567,7 +561,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
case MotionEvent.ACTION_UP: // 1
|
||||
case MotionEvent.ACTION_CANCEL: // 3
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
AndroidDisplay.putMouseEventWithCoords(!AndroidDisplay.mouseLeft /* rightOverride */ ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
LWJGLInputSender.sendCursorPos(x, y);
|
||||
LWJGLInputSender.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, true);
|
||||
// LWJGLInputSender.putMouseEventWithCoords(!LWJGLInputSender.mouseLeft /* rightOverride */ ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
/*
|
||||
if (!triggeredLeftMouseButton && Math.abs(initialX - x) < fingerStillThreshold && Math.abs(initialY - y) < fingerStillThreshold) {
|
||||
sendMouseButton(1, true);
|
||||
|
|
@ -578,7 +574,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
*/
|
||||
|
||||
sendMouseButton(AndroidDisplay.mouseLeft ? 0 : 1, true);
|
||||
sendMouseButton(LWJGLInputSender.mouseLeft ? 0 : 1, true);
|
||||
|
||||
// triggeredLeftMouseButton = false;
|
||||
// theHandler.removeMessages(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK);
|
||||
|
|
@ -603,7 +599,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
minecraftGLView.setOnHoverListener(new View.OnHoverListener(){
|
||||
@Override
|
||||
public boolean onHover(View p1, MotionEvent p2) {
|
||||
if (!AndroidDisplay.grab && mIsResuming) {
|
||||
if (!LWJGLInputSender.isGrabbing() && mIsResuming) {
|
||||
return glTouchListener.onTouch(p1, p2);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -615,8 +611,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
private boolean isCalled = false;
|
||||
@Override
|
||||
public void onSurfaceTextureAvailable(SurfaceTexture texture, int width, int height) {
|
||||
AndroidDisplay.windowWidth = width;
|
||||
AndroidDisplay.windowHeight = height;
|
||||
LWJGLInputSender.windowWidth = width;
|
||||
LWJGLInputSender.windowHeight = height;
|
||||
calculateMcScale();
|
||||
|
||||
// Should we do that?
|
||||
|
|
@ -647,8 +643,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
|
||||
@Override
|
||||
public void onSurfaceTextureSizeChanged(SurfaceTexture texture, int width, int height) {
|
||||
AndroidDisplay.windowWidth = width;
|
||||
AndroidDisplay.windowHeight = height;
|
||||
LWJGLInputSender.windowWidth = width;
|
||||
LWJGLInputSender.windowHeight = height;
|
||||
calculateMcScale();
|
||||
|
||||
// TODO: Implement this method for GLFW window size callback
|
||||
|
|
@ -734,8 +730,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
@Override
|
||||
protected void onPause()
|
||||
{
|
||||
if (AndroidDisplay.grab){
|
||||
sendKeyPress(Keyboard.KEY_ESCAPE);
|
||||
if (LWJGLInputSender.isGrabbing()){
|
||||
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
|
||||
}
|
||||
mIsResuming = false;
|
||||
super.onPause();
|
||||
|
|
@ -779,30 +775,30 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
|
||||
switch (v.getId()) {
|
||||
case R.id.control_up: sendKeyPress(Keyboard.KEY_W, isDown); break;
|
||||
case R.id.control_left: sendKeyPress(Keyboard.KEY_A, isDown); break;
|
||||
case R.id.control_down: sendKeyPress(Keyboard.KEY_S, isDown); break;
|
||||
case R.id.control_right: sendKeyPress(Keyboard.KEY_D, isDown); break;
|
||||
case R.id.control_jump: sendKeyPress(Keyboard.KEY_SPACE, isDown); break;
|
||||
case R.id.control_up: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_W, isDown); break;
|
||||
case R.id.control_left: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_A, isDown); break;
|
||||
case R.id.control_down: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_S, isDown); break;
|
||||
case R.id.control_right: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_D, isDown); break;
|
||||
case R.id.control_jump: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_SPACE, isDown); break;
|
||||
case R.id.control_primary: sendMouseButton(0, isDown); break;
|
||||
case R.id.control_secondary:
|
||||
if (AndroidDisplay.grab) {
|
||||
if (LWJGLInputSender.isGrabbing()) {
|
||||
sendMouseButton(1, isDown);
|
||||
} else {
|
||||
if (!isDown) {
|
||||
AndroidDisplay.putMouseEventWithCoords(/* right mouse */ (byte) 1, (byte) 0, AndroidDisplay.mouseX, AndroidDisplay.mouseY, 0, System.nanoTime());
|
||||
AndroidDisplay.putMouseEventWithCoords(/* right mouse */ (byte) 1, (byte) 1, AndroidDisplay.mouseX, AndroidDisplay.mouseY, 0, System.nanoTime());
|
||||
LWJGLInputSender.sendCursorPos(LWJGLInputSender.mouseX, LWJGLInputSender.mouseY);
|
||||
LWJGLInputSender.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT);
|
||||
}
|
||||
setRightOverride(isDown);
|
||||
} break;
|
||||
case R.id.control_debug: sendKeyPress(Keyboard.KEY_F3, isDown); break;
|
||||
case R.id.control_shift: sendKeyPress(Keyboard.KEY_LSHIFT, isDown); break;
|
||||
case R.id.control_inventory: sendKeyPress(Keyboard.KEY_E, isDown); break;
|
||||
case R.id.control_talk: sendKeyPress(Keyboard.KEY_T, isDown); break;
|
||||
case R.id.control_debug: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F3, isDown); break;
|
||||
case R.id.control_shift: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, isDown); break;
|
||||
case R.id.control_inventory: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_E, isDown); break;
|
||||
case R.id.control_talk: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_T, isDown); break;
|
||||
case R.id.control_keyboard: showKeyboard(); break;
|
||||
case R.id.control_thirdperson: sendKeyPress(Keyboard.KEY_F5, isDown); break;
|
||||
case R.id.control_zoom: sendKeyPress(Keyboard.KEY_C, isDown); break;
|
||||
case R.id.control_listplayers: sendKeyPress(Keyboard.KEY_TAB, isDown); break;
|
||||
case R.id.control_thirdperson: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F5, isDown); break;
|
||||
case R.id.control_zoom: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_C, isDown); break;
|
||||
case R.id.control_listplayers: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_TAB, isDown); break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -941,9 +937,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK /*1028*/:
|
||||
int x = AndroidDisplay.mouseX;
|
||||
int y = AndroidDisplay.mouseY;
|
||||
if (AndroidDisplay.grab && Math.abs(initialX - x) < fingerStillThreshold && Math.abs(initialY - y) < fingerStillThreshold) {
|
||||
int x = LWJGLInputSender.mouseX;
|
||||
int y = LWJGLInputSender.mouseY;
|
||||
if (LWJGLInputSender.isGrabbing() && Math.abs(initialX - x) < fingerStillThreshold && Math.abs(initialY - y) < fingerStillThreshold) {
|
||||
triggeredLeftMouseButton = true;
|
||||
sendMouseButton(0, true);
|
||||
return;
|
||||
|
|
@ -994,7 +990,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
|
||||
public void toggleMouse(View view) {
|
||||
if (AndroidDisplay.grab) return;
|
||||
if (LWJGLInputSender.isGrabbing()) return;
|
||||
|
||||
boolean isVis = touchPad.getVisibility() == View.VISIBLE;
|
||||
touchPad.setVisibility(isVis ? View.GONE : View.VISIBLE);
|
||||
|
|
@ -1065,7 +1061,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
|
||||
public void sendKeyPress(int keyCode, char keyChar, boolean status) {
|
||||
AndroidDisplay.setKey(keyCode, keyChar, status);
|
||||
// FIXME keyChar
|
||||
LWJGLInputSender.sendKeycode(keyCode, /* keyChar, */ status);
|
||||
}
|
||||
|
||||
public void sendKeyPress(char keyChar) {
|
||||
|
|
@ -1079,13 +1076,14 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
|
||||
public void sendMouseButton(int button, boolean status) {
|
||||
AndroidDisplay.setMouseButtonInGrabMode((byte) button, status ? (byte) 1 : (byte) 0);
|
||||
// TODO implement this method!!!
|
||||
// LWJGLInputSender.setMouseButtonInGrabMode((byte) button, status ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
public void calculateMcScale() {
|
||||
int scale = 1;
|
||||
int screenWidth = AndroidDisplay.windowWidth;
|
||||
int screenHeight = AndroidDisplay.windowHeight;
|
||||
int screenWidth = LWJGLInputSender.windowWidth;
|
||||
int screenHeight = LWJGLInputSender.windowHeight;
|
||||
while (screenWidth / (scale + 1) >= 320 && screenHeight / (scale + 1) >= 240) {
|
||||
scale++;
|
||||
}
|
||||
|
|
@ -1093,12 +1091,12 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||
}
|
||||
|
||||
public int handleGuiBar(int x, int y, MotionEvent e) {
|
||||
if (!AndroidDisplay.grab) {
|
||||
if (!LWJGLInputSender.isGrabbing()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int screenWidth = AndroidDisplay.windowWidth;
|
||||
int screenHeight = AndroidDisplay.windowHeight;
|
||||
int screenWidth = LWJGLInputSender.windowWidth;
|
||||
int screenHeight = LWJGLInputSender.windowHeight;
|
||||
int barheight = mcscale(20);
|
||||
int barwidth = mcscale(180);
|
||||
int barx = (screenWidth / 2) - (barwidth / 2);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class PojavApplication extends Application
|
|||
Tools.datapath = getDir("files", MODE_PRIVATE).getParent();
|
||||
|
||||
LauncherPreferences.DEFAULT_PREF = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
LauncherPreferences.loadPreferences(this);
|
||||
LauncherPreferences.loadPreferences();
|
||||
|
||||
ControlButton.pixelOf2dp = (int) Tools.dpToPx(this, 2);
|
||||
ControlButton.pixelOf30dp = (int) Tools.dpToPx(this, 30);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import javax.microedition.khronos.egl.*;
|
|||
import net.kdt.pojavlaunch.patcher.*;
|
||||
import net.kdt.pojavlaunch.util.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
|
||||
public final class Tools
|
||||
{
|
||||
|
|
@ -100,8 +100,8 @@ public final class Tools
|
|||
javaArgList.add("-Dorg.lwjgl.util.DebugLoader=true");
|
||||
|
||||
// GLFW Stub width height
|
||||
javaArgList.add("-Dglfwstub.windowWidth=" + AndroidDisplay.windowWidth);
|
||||
javaArgList.add("-Dglfwstub.windowHeight=" + AndroidDisplay.windowHeight);
|
||||
javaArgList.add("-Dglfwstub.windowWidth=" + LWJGLInputSender.windowWidth);
|
||||
javaArgList.add("-Dglfwstub.windowHeight=" + LWJGLInputSender.windowHeight);
|
||||
|
||||
javaArgList.add("-Dglfwstub.initEgl=false");
|
||||
|
||||
|
|
@ -116,6 +116,7 @@ public final class Tools
|
|||
if (LAUNCH_TYPE == LTYPE_CREATEJAVAVM) {
|
||||
javaArgList.add("-Djava.library.path=" + launchClassPath);
|
||||
} else {
|
||||
/*
|
||||
if (LAUNCH_TYPE == LTYPE_PROCESS) {
|
||||
javaArgList.add("-Dglfwstub.eglContext=" + Tools.getEGLAddress("Context", AndroidContextImplementation.context));
|
||||
String eglDisplay = Tools.getEGLAddress("Display", AndroidContextImplementation.display);
|
||||
|
|
@ -127,7 +128,10 @@ public final class Tools
|
|||
javaArgList.add("-Dglfwstub.eglSurfaceRead=" + Tools.getEGLAddress("Surface", AndroidContextImplementation.read));
|
||||
javaArgList.add("-Dglfwstub.eglSurfaceDraw=" + Tools.getEGLAddress("Surface", AndroidContextImplementation.draw));
|
||||
}
|
||||
|
||||
*/
|
||||
// Put at the end of default args to allow override args
|
||||
javaArgList.addAll(Arrays.asList(LauncherPreferences.PREF_CUSTOM_JAVA_ARGS.split(" ")));
|
||||
|
||||
javaArgList.add("-cp");
|
||||
javaArgList.add(launchClassPath);
|
||||
javaArgList.add(versionInfo.mainClass);
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
package net.kdt.pojavlaunch.jrereflect;
|
||||
|
||||
public class JREClass extends JRENativeObject
|
||||
{
|
||||
public static JREClass forName(String name) throws ClassNotFoundException {
|
||||
long nativeAddr = nativeForName(name);
|
||||
if (nativeAddr == 0) throw new ClassNotFoundException(name);
|
||||
return new JREClass(nativeAddr);
|
||||
}
|
||||
|
||||
private JREClass(long nativeAddr) {
|
||||
super(nativeAddr);
|
||||
}
|
||||
|
||||
private JREMethod getMethod(String name, Class... types) throws NoSuchMethodException {
|
||||
long nativeAddr = nativeForName(name);
|
||||
if (nativeAddr == 0) throw new NoSuchMethodException(name);
|
||||
return new JREMethod(nativeAddr, name, types);
|
||||
}
|
||||
|
||||
public static native long nativeForName(String name);
|
||||
public static native long nativeGetMethod(String name);
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
package net.kdt.pojavlaunch.jrereflect;
|
||||
|
||||
public class JREMethod extends JRENativeObject
|
||||
{
|
||||
JREMethod(long nativeAddr, String name, Class... types) {
|
||||
super(nativeAddr);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
package net.kdt.pojavlaunch.jrereflect;
|
||||
|
||||
public class JRENativeObject
|
||||
{
|
||||
protected long mNativeAddress;
|
||||
protected JRENativeObject(long nativeAddress) {
|
||||
mNativeAddress = nativeAddress;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ public class LauncherPreferenceActivity extends MinePrefActivity
|
|||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
LauncherPreferences.loadPreferences(this);
|
||||
LauncherPreferences.loadPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package net.kdt.pojavlaunch.prefs;
|
|||
|
||||
import android.os.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import android.support.v7.preference.EditTextPreference;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import android.support.v7.preference.SeekBarPreference;
|
||||
|
||||
|
|
@ -23,5 +24,7 @@ public class LauncherPreferenceFragment extends PreferenceFragmentCompat
|
|||
seek2.setMin(100);
|
||||
seek2.setMax(1000);
|
||||
seek2.setValue(500);
|
||||
|
||||
findPreference("javaArgs").setDefaultValue(LauncherPreferences.PREF_CUSTOM_JAVA_ARGS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package net.kdt.pojavlaunch.prefs;
|
|||
|
||||
import android.content.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import android.os.*;
|
||||
|
||||
public class LauncherPreferences
|
||||
{
|
||||
|
|
@ -14,8 +15,9 @@ public class LauncherPreferences
|
|||
public static float PREF_BUTTONSIZE = 1.0f;
|
||||
public static int PREF_LONGPRESS_TRIGGER = 500;
|
||||
public static String PREF_DEFAULTCTRL_PATH = Tools.CTRLDEF_FILE;
|
||||
public static String PREF_CUSTOM_JAVA_ARGS;
|
||||
|
||||
public static void loadPreferences(Context ctx) {
|
||||
public static void loadPreferences() {
|
||||
PREF_BUTTONSIZE = DEFAULT_PREF.getFloat("controlSize", 1f);
|
||||
PREF_FREEFORM = DEFAULT_PREF.getBoolean("freeform", false);
|
||||
PREF_VERTYPE_RELEASE = DEFAULT_PREF.getBoolean("vertype_release", true);
|
||||
|
|
@ -24,5 +26,18 @@ public class LauncherPreferences
|
|||
PREF_VERTYPE_OLDBETA = DEFAULT_PREF.getBoolean("vertype_oldbeta", false);
|
||||
PREF_LONGPRESS_TRIGGER = DEFAULT_PREF.getInt("timeLongPressTrigger", 500);
|
||||
PREF_DEFAULTCTRL_PATH = DEFAULT_PREF.getString("defaultCtrl", Tools.CTRLDEF_FILE);
|
||||
// Get double of max Android heap to set default heap size
|
||||
int androidHeap = (int) (Runtime.getRuntime().maxMemory() / 1024l / 512l);
|
||||
PREF_CUSTOM_JAVA_ARGS = DEFAULT_PREF.getString("customJavaArgs",
|
||||
"-Xms" + androidHeap + " " +
|
||||
"-Xmx" + (androidHeap * 2) + " " +
|
||||
"-XX:+UseG1GC " +
|
||||
"-Dsun.rmi.dgc.server.gcInterval=2147483646 " +
|
||||
"-XX:+UnlockExperimentalVMOptions " +
|
||||
"-XX:G1NewSizePercent=20 " +
|
||||
"-XX:G1ReservePercent=20 " +
|
||||
"-XX:MaxGCPauseMillis=50 " +
|
||||
"-XX:G1HeapRegionSize=32M"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class PojavPreferenceActivity extends MineActivity implements OnCheckedCh
|
|||
* - Having trouble setting.
|
||||
*/
|
||||
|
||||
LauncherPreferences.loadPreferences(this);
|
||||
LauncherPreferences.loadPreferences();
|
||||
|
||||
mainPreference = getSharedPreferences("pojav_preferences", MODE_PRIVATE);
|
||||
final SharedPreferences.Editor mainPrefEdit = mainPreference.edit();
|
||||
|
|
@ -84,7 +84,7 @@ public class PojavPreferenceActivity extends MineActivity implements OnCheckedCh
|
|||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
LauncherPreferences.loadPreferences(this);
|
||||
LauncherPreferences.loadPreferences();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import net.kdt.pojavlaunch.*;
|
|||
import android.view.*;
|
||||
import java.util.*;
|
||||
import android.content.*;
|
||||
import org.lwjgl.input.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import android.view.View.*;
|
||||
|
||||
public class ControlButton implements Cloneable
|
||||
|
|
@ -28,10 +26,10 @@ public class ControlButton implements Cloneable
|
|||
if (SPECIAL_BUTTONS == null) {
|
||||
SPECIAL_BUTTONS = new ControlButton[]{
|
||||
new ControlButton("Keyboard", SPECIALBTN_KEYBOARD, pixelOf2dp * 3 + pixelOf80dp * 2, pixelOf2dp, false),
|
||||
new ControlButton("GUI", SPECIALBTN_TOGGLECTRL, pixelOf2dp, AndroidDisplay.windowHeight - pixelOf50dp * 2 + pixelOf2dp * 4),
|
||||
new ControlButton("PRI", SPECIALBTN_MOUSEPRI, pixelOf2dp, AndroidDisplay.windowHeight - pixelOf50dp * 4 + pixelOf2dp * 2),
|
||||
new ControlButton("SEC", SPECIALBTN_MOUSESEC, pixelOf2dp * 3 + pixelOf50dp * 2, AndroidDisplay.windowHeight - pixelOf50dp * 4 + pixelOf2dp * 2),
|
||||
new ControlButton("Mouse", SPECIALBTN_VIRTUALMOUSE, AndroidDisplay.windowWidth - pixelOf80dp, pixelOf2dp, false)
|
||||
new ControlButton("GUI", SPECIALBTN_TOGGLECTRL, pixelOf2dp, LWJGLInputSender.windowHeight - pixelOf50dp * 2 + pixelOf2dp * 4),
|
||||
new ControlButton("PRI", SPECIALBTN_MOUSEPRI, pixelOf2dp, LWJGLInputSender.windowHeight - pixelOf50dp * 4 + pixelOf2dp * 2),
|
||||
new ControlButton("SEC", SPECIALBTN_MOUSESEC, pixelOf2dp * 3 + pixelOf50dp * 2, LWJGLInputSender.windowHeight - pixelOf50dp * 4 + pixelOf2dp * 2),
|
||||
new ControlButton("Mouse", SPECIALBTN_VIRTUALMOUSE, LWJGLInputSender.windowWidth - pixelOf80dp, pixelOf2dp, false)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +63,7 @@ public class ControlButton implements Cloneable
|
|||
// public boolean hold
|
||||
|
||||
public ControlButton() {
|
||||
this("", Keyboard.CHAR_NONE, 0, 0);
|
||||
this("", LWJGLGLFWKeycode.GLFW_KEY_UNKNOWN, 0, 0);
|
||||
}
|
||||
|
||||
public ControlButton(String name, int keycode) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ import java.util.*;
|
|||
import net.kdt.pojavlaunch.*;
|
||||
import com.google.gson.*;
|
||||
import android.content.*;
|
||||
import org.lwjgl.input.*;
|
||||
import org.lwjgl.opengl.AndroidDisplay;
|
||||
|
||||
public class CustomControls
|
||||
{
|
||||
|
|
@ -20,25 +18,25 @@ public class CustomControls
|
|||
// Generate default control
|
||||
public CustomControls(Context ctx) {
|
||||
this();
|
||||
this.button.add(ControlButton.getSpecialButtons()[0].clone()); // Keyboard
|
||||
this.button.add(ControlButton.getSpecialButtons()[0].clone()); // LWJGLGLFWKeycode
|
||||
this.button.add(ControlButton.getSpecialButtons()[1].clone()); // GUI
|
||||
this.button.add(ControlButton.getSpecialButtons()[2].clone()); // Primary Mouse button
|
||||
this.button.add(ControlButton.getSpecialButtons()[3].clone()); // Secondary Mouse button
|
||||
this.button.add(ControlButton.getSpecialButtons()[4].clone()); // Virtual mouse toggle
|
||||
|
||||
this.button.add(new ControlButton(ctx, R.string.control_debug, Keyboard.KEY_F3, ControlButton.pixelOf2dp, ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_chat, Keyboard.KEY_T, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf80dp, ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_listplayers, Keyboard.KEY_TAB, ControlButton.pixelOf2dp * 4 + ControlButton.pixelOf80dp * 3, ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_thirdperson, Keyboard.KEY_F5, ControlButton.pixelOf2dp, ControlButton.pixelOf30dp + ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_debug, LWJGLGLFWKeycode.GLFW_KEY_F3, ControlButton.pixelOf2dp, ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_chat, LWJGLGLFWKeycode.GLFW_KEY_T, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf80dp, ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_listplayers, LWJGLGLFWKeycode.GLFW_KEY_TAB, ControlButton.pixelOf2dp * 4 + ControlButton.pixelOf80dp * 3, ControlButton.pixelOf2dp, false));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_thirdperson, LWJGLGLFWKeycode.GLFW_KEY_F5, ControlButton.pixelOf2dp, ControlButton.pixelOf30dp + ControlButton.pixelOf2dp, false));
|
||||
|
||||
this.button.add(new ControlButton(ctx, R.string.control_up, Keyboard.KEY_W, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf50dp, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp * 3 - ControlButton.pixelOf50dp * 3, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_left, Keyboard.KEY_A, ControlButton.pixelOf2dp, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_down, Keyboard.KEY_S, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf50dp, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp - ControlButton.pixelOf50dp, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_right, Keyboard.KEY_D, ControlButton.pixelOf2dp * 3 + ControlButton.pixelOf50dp * 2, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_up, LWJGLGLFWKeycode.GLFW_KEY_W, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf50dp, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp * 3 - ControlButton.pixelOf50dp * 3, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_left, LWJGLGLFWKeycode.GLFW_KEY_A, ControlButton.pixelOf2dp, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_down, LWJGLGLFWKeycode.GLFW_KEY_S, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf50dp, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp - ControlButton.pixelOf50dp, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_right, LWJGLGLFWKeycode.GLFW_KEY_D, ControlButton.pixelOf2dp * 3 + ControlButton.pixelOf50dp * 2, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
|
||||
this.button.add(new ControlButton(ctx, R.string.control_inventory, Keyboard.KEY_E, ControlButton.pixelOf2dp * 3 + ControlButton.pixelOf50dp * 2, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp - ControlButton.pixelOf50dp, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_shift, Keyboard.KEY_LSHIFT, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf50dp, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_jump, Keyboard.KEY_SPACE, AndroidDisplay.windowWidth - ControlButton.pixelOf2dp * 3 - ControlButton.pixelOf50dp * 2, AndroidDisplay.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_inventory, LWJGLGLFWKeycode.GLFW_KEY_E, ControlButton.pixelOf2dp * 3 + ControlButton.pixelOf50dp * 2, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp - ControlButton.pixelOf50dp, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_shift, LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, ControlButton.pixelOf2dp * 2 + ControlButton.pixelOf50dp, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
this.button.add(new ControlButton(ctx, R.string.control_jump, LWJGLGLFWKeycode.GLFW_KEY_SPACE, LWJGLInputSender.windowWidth - ControlButton.pixelOf2dp * 3 - ControlButton.pixelOf50dp * 2, LWJGLInputSender.windowHeight - ControlButton.pixelOf2dp * 2 - ControlButton.pixelOf50dp * 2, true));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||
printf("First frame error: %p\n", eglGetError());
|
||||
#endif
|
||||
|
||||
isEglMakeCurrentCalled = 1;
|
||||
|
||||
return success == EGL_TRUE ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
18
app/src/main/jni/input_bridge.c
Normal file
18
app/src/main/jni/input_bridge.c
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <jni.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_LWJGLInputSender(JNIEnv* env, jclass clazz, jint type, jstring data) {
|
||||
if (isEglMakeCurrentCalled == 1) {
|
||||
// Convert Dalvik string to JRE string: should or use directly?
|
||||
char *data_c = (char*)(*env)->GetStringUTFChars(env, data, 0);
|
||||
jstring data_jre = (*runtimeJNIEnvPtr)->NewStringUTF(runtimeJNIEnvPtr, data_c);
|
||||
(*env)->ReleaseStringUTFChars(env, data, data_c);
|
||||
|
||||
jclass sendClass = (*runtimeJNIEnvPtr)->FindClass(runtimeJNIEnvPtr, main_class_c);
|
||||
jmethodID sendMethod = (*runtimeJNIEnvPtr)->GetStaticMethodID(runtimeJNIEnvPtr, sendClass, "receiveCallback", "(ILjava/lang/String;)V");
|
||||
(*runtimeJNIEnvPtr)->CallStaticVoidMethod(runtimeJNIEnvPtr, sendClass, sendMethod, type, data_jre);
|
||||
}
|
||||
// else: too early!
|
||||
}
|
||||
|
||||
|
|
@ -53,24 +53,22 @@ typedef jint JLI_Launch_func(int argc, char ** argv, /* main argc, argc */
|
|||
jint ergo /* ergonomics class policy */
|
||||
);
|
||||
|
||||
JavaVM *runtimeJavaVMPtr = NULL;;
|
||||
JNIEnv *runtimeJNIEnvPtr = NULL;
|
||||
|
||||
JavaVM *dalvikJavaVMPtr = NULL;
|
||||
JNIEnv *dalvikJNIEnvPtr = NULL;
|
||||
|
||||
jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
{
|
||||
if (dalvikJavaVMPtr == NULL) {
|
||||
//Save dalvik global JavaVM pointer
|
||||
dalvikJavaVMPtr = vm;
|
||||
(*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4);
|
||||
/* Boardwalk: not used
|
||||
LOGD("JNI_OnLoad calling GetEnv()");
|
||||
JNIEnv* env = NULL;
|
||||
(*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4);
|
||||
/* Boardwalk: not used
|
||||
LOGD("JNI_OnLoad calling initDalvikProxySelectorData()");
|
||||
initDalvikProxySelectorData(env);
|
||||
*/
|
||||
} else if (dalvikJavaVMPtr != vm) {
|
||||
runtimeJavaVMPtr = vm;
|
||||
(*vm)->GetEnv(vm, (void**) &runtimeJNIEnvPtr, JNI_VERSION_1_4);
|
||||
}
|
||||
LOGD("JNI_OnLoad returning()");
|
||||
return JNI_VERSION_1_4;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
#ifndef _BINARY_UTILS_H_
|
||||
#define _BINARY_UTILS_H_
|
||||
|
||||
JavaVM *runtimeJavaVMPtr = NULL;;
|
||||
JNIEnv *runtimeJNIEnvPtr = NULL;
|
||||
|
||||
JavaVM *dalvikJavaVMPtr = NULL;
|
||||
JNIEnv *dalvikJNIEnvPtr = NULL;
|
||||
|
||||
int isEglMakeCurrentCalled = 0;
|
||||
|
||||
char** convert_to_char_array(JNIEnv *env, jobjectArray jstringArray);
|
||||
jobjectArray convert_from_char_array(JNIEnv *env, char **charArray, int num_rows);
|
||||
void free_char_array(JNIEnv *env, jobjectArray jstringArray, const char **charArray);
|
||||
|
|
|
|||
BIN
app/src/main/jniLibs/armeabi-v7a/libRegal.so
Normal file
BIN
app/src/main/jniLibs/armeabi-v7a/libRegal.so
Normal file
Binary file not shown.
|
|
@ -19,11 +19,11 @@
|
|||
<string name="login_online_username_question">(Którego mam użyć?)</string>
|
||||
<string name="login_online_password_hint">Hasło</string>
|
||||
<string name="login_online_password_question">Zapomniałeś hasła?</string>
|
||||
<string name="login_online_remember">Zapamiętaj mnie?</string>
|
||||
<string name="login_online_check_keeplogin">Pozostaw mnie zalogowanym</string>
|
||||
<string name="login_online_login_label">Zaloguj sie</string>
|
||||
<string name="login_online_create_account">(Stwórz nowe konto?)</string>
|
||||
|
||||
<string name="login_offline_switch">Konto offline?</string>
|
||||
<string name="login_offline_label">Zaloguj się jako konto offline</string>
|
||||
<string name="login_offline_alert_skip">Pominąć</string>
|
||||
|
||||
<string name="login_error_short_username">Nazwa użytkownika musi mieć co najmniej 3 znaki</string>
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@
|
|||
<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_controlsize">Set control buttons size</string>
|
||||
<string name="mcl_setting_title_forgetoptifpath">Make OptiFine unable to locate itself</string>
|
||||
<string name="mcl_setting_subtitle_forgetoptifpath">Useful for making OptiFine launchable on some devices.</string>
|
||||
<string name="mcl_setting_title_javaargs">JRE Launch arguments</string>
|
||||
<string name="mcl_setting_subtitle_javaargs">Be careful, this may make game crash if modified without knowledge.</string>
|
||||
<string name="mcl_setting_category_general">General settings</string>
|
||||
<string name="mcl_setting_category_veroption">Version type will be in version list</string>
|
||||
<string name="mcl_setting_veroption_release">Release</string>
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@
|
|||
android:title="@string/mcl_setting_title_longpresstrigger"
|
||||
android:summary="@string/mcl_setting_subtitle_longpresstrigger" />
|
||||
|
||||
<android.support.v7.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="forgetOptifinePath"
|
||||
android:title="@string/mcl_setting_title_forgetoptifpath"
|
||||
android:summary="@string/mcl_setting_subtitle_forgetoptifpath"/>
|
||||
|
||||
<android.support.v7.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="freeform"
|
||||
android:title="@string/mcl_setting_title_freeform"
|
||||
android:summary="@string/mcl_setting_subtitle_freeform"/>
|
||||
|
||||
<android.support.v7.preference.EditTextPreference
|
||||
android:key="javaArgs"
|
||||
android:title="@string/mcl_setting_title_javaargs"
|
||||
android:summary="@string/mcl_setting_subtitle_javaargs"
|
||||
android:dialogTitle="dialog_title_edittext_preference"/>
|
||||
|
||||
</android.support.v7.preference.PreferenceCategory>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue