mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Tab -> spaces; Set win size also set monitor size
This commit is contained in:
parent
9bc686b591
commit
871e97fe9c
@ -496,20 +496,20 @@ public class GLFW
|
|||||||
|
|
||||||
private static ArrayMap<Long, GLFWWindowProperties> mGLFWWindowMap;
|
private static ArrayMap<Long, GLFWWindowProperties> mGLFWWindowMap;
|
||||||
|
|
||||||
public static boolean mGLFWIsGrabbing, mGLFWIsInputReady, mGLFWIsUseStackQueue = false;
|
public static boolean mGLFWIsGrabbing, mGLFWIsInputReady, mGLFWIsUseStackQueue = false;
|
||||||
public static final byte[] keyDownBuffer = new byte[316];
|
public static final byte[] keyDownBuffer = new byte[316];
|
||||||
private static final String PROP_WINDOW_WIDTH = "glfwstub.windowWidth";
|
private static final String PROP_WINDOW_WIDTH = "glfwstub.windowWidth";
|
||||||
private static final String PROP_WINDOW_HEIGHT= "glfwstub.windowHeight";
|
private static final String PROP_WINDOW_HEIGHT= "glfwstub.windowHeight";
|
||||||
public static long mainContext = 0;
|
public static long mainContext = 0;
|
||||||
static {
|
static {
|
||||||
String windowWidth = System.getProperty(PROP_WINDOW_WIDTH);
|
String windowWidth = System.getProperty(PROP_WINDOW_WIDTH);
|
||||||
String windowHeight = System.getProperty(PROP_WINDOW_HEIGHT);
|
String windowHeight = System.getProperty(PROP_WINDOW_HEIGHT);
|
||||||
if (windowWidth == null || windowHeight == null) {
|
if (windowWidth == null || windowHeight == null) {
|
||||||
System.err.println("Warning: Property " + PROP_WINDOW_WIDTH + " or " + PROP_WINDOW_HEIGHT + " not set, defaulting to 1280 and 720");
|
System.err.println("Warning: Property " + PROP_WINDOW_WIDTH + " or " + PROP_WINDOW_HEIGHT + " not set, defaulting to 1280 and 720");
|
||||||
|
|
||||||
mGLFWWindowWidth = 1280;
|
mGLFWWindowWidth = 1280;
|
||||||
mGLFWWindowHeight = 720;
|
mGLFWWindowHeight = 720;
|
||||||
} else {
|
} else {
|
||||||
mGLFWWindowWidth = Integer.parseInt(windowWidth);
|
mGLFWWindowWidth = Integer.parseInt(windowWidth);
|
||||||
mGLFWWindowHeight = Integer.parseInt(windowHeight);
|
mGLFWWindowHeight = Integer.parseInt(windowHeight);
|
||||||
}
|
}
|
||||||
@ -518,14 +518,14 @@ public class GLFW
|
|||||||
CallbackBridge.receiveCallback(CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE, mGLFWWindowWidth, mGLFWWindowHeight, 0, 0);
|
CallbackBridge.receiveCallback(CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE, mGLFWWindowWidth, mGLFWWindowHeight, 0, 0);
|
||||||
CallbackBridge.receiveCallback(CallbackBridge.EVENT_TYPE_WINDOW_SIZE, mGLFWWindowWidth, mGLFWWindowHeight, 0, 0);
|
CallbackBridge.receiveCallback(CallbackBridge.EVENT_TYPE_WINDOW_SIZE, mGLFWWindowWidth, mGLFWWindowHeight, 0, 0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.loadLibrary("pojavexec");
|
System.loadLibrary("pojavexec");
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
mGLFWErrorCallback = GLFWErrorCallback.createPrint();
|
mGLFWErrorCallback = GLFWErrorCallback.createPrint();
|
||||||
mGLFWKeyCodes = new ArrayMap<>();
|
mGLFWKeyCodes = new ArrayMap<>();
|
||||||
|
|
||||||
mGLFWWindowMap = new ArrayMap<>();
|
mGLFWWindowMap = new ArrayMap<>();
|
||||||
|
|
||||||
@ -638,6 +638,13 @@ public class GLFW
|
|||||||
return GLFW;
|
return GLFW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void internalChangeMonitorSize(int width, int height) {
|
||||||
|
mGLFWWindowWidth = width;
|
||||||
|
mGLFWWindowHeight = height;
|
||||||
|
memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.WIDTH, mGLFWWindowWidth);
|
||||||
|
memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.HEIGHT, mGLFWWindowHeight);
|
||||||
|
}
|
||||||
|
|
||||||
public static GLFWWindowProperties internalGetWindow(long window) {
|
public static GLFWWindowProperties internalGetWindow(long window) {
|
||||||
GLFWWindowProperties win = mGLFWWindowMap.get(window);
|
GLFWWindowProperties win = mGLFWWindowMap.get(window);
|
||||||
if (win == null) {
|
if (win == null) {
|
||||||
@ -944,37 +951,37 @@ public class GLFW
|
|||||||
return mGLFWGammaRamp;
|
return mGLFWGammaRamp;
|
||||||
}
|
}
|
||||||
public static void glfwSetGammaRamp(@NativeType("GLFWmonitor *") long monitor, @NativeType("const GLFWgammaramp *") GLFWGammaRamp ramp) {
|
public static void glfwSetGammaRamp(@NativeType("GLFWmonitor *") long monitor, @NativeType("const GLFWgammaramp *") GLFWGammaRamp ramp) {
|
||||||
mGLFWGammaRamp = ramp;
|
mGLFWGammaRamp = ramp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void glfwMakeContextCurrent(long window) {
|
public static void glfwMakeContextCurrent(long window) {
|
||||||
//Probably not the best idea to rely on program's internals to share the contexts...
|
//Probably not the best idea to rely on program's internals to share the contexts...
|
||||||
try{
|
try{
|
||||||
throw new Exception("Trace exception");
|
throw new Exception("Trace exception");
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
nativeEglMakeCurrent(window);
|
nativeEglMakeCurrent(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void glfwSwapBuffers(long window) {
|
public static void glfwSwapBuffers(long window) {
|
||||||
nativeEglSwapBuffers();
|
nativeEglSwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void glfwSwapInterval(int interval) {
|
public static void glfwSwapInterval(int interval) {
|
||||||
nativeEglSwapInterval(interval);
|
nativeEglSwapInterval(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static double mTime = 0d;
|
// private static double mTime = 0d;
|
||||||
public static double glfwGetTime() {
|
public static double glfwGetTime() {
|
||||||
// Boardwalk: just use system timer
|
// Boardwalk: just use system timer
|
||||||
// System.out.println("glfwGetTime");
|
// System.out.println("glfwGetTime");
|
||||||
return (System.nanoTime() - mGLFWInitialTime) / 1.e9;
|
return (System.nanoTime() - mGLFWInitialTime) / 1.e9;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void glfwSetTime(double time) {
|
public static void glfwSetTime(double time) {
|
||||||
mGLFWInitialTime = System.nanoTime() - (long) time;
|
mGLFWInitialTime = System.nanoTime() - (long) time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long glfwGetTimerValue() {
|
public static long glfwGetTimerValue() {
|
||||||
return System.currentTimeMillis();
|
return System.currentTimeMillis();
|
||||||
@ -1118,8 +1125,7 @@ public class GLFW
|
|||||||
break;
|
break;
|
||||||
case CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE:
|
case CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE:
|
||||||
case CallbackBridge.EVENT_TYPE_WINDOW_SIZE:
|
case CallbackBridge.EVENT_TYPE_WINDOW_SIZE:
|
||||||
mGLFWWindowWidth = dataArr[1];
|
internalChangeMonitorSize(dataArr[1], dataArr[2]);
|
||||||
mGLFWWindowHeight = dataArr[2];
|
|
||||||
glfwSetWindowSize(ptr, mGLFWWindowWidth, mGLFWWindowHeight);
|
glfwSetWindowSize(ptr, mGLFWWindowWidth, mGLFWWindowHeight);
|
||||||
if (dataArr[0] == CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE && mGLFWFramebufferSizeCallback != null) {
|
if (dataArr[0] == CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE && mGLFWFramebufferSizeCallback != null) {
|
||||||
mGLFWFramebufferSizeCallback.invoke(ptr, mGLFWWindowWidth, mGLFWWindowHeight);
|
mGLFWFramebufferSizeCallback.invoke(ptr, mGLFWWindowWidth, mGLFWWindowHeight);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user