GLFW.java: add missing array version of functions

This commit is contained in:
Duy Tran Khanh 2022-01-10 07:44:38 +07:00 committed by GitHub
parent 10e4187a76
commit bb9d2eaf9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -817,17 +817,17 @@ public class GLFW
isGLFWReady = invokeI(__functionAddress) != 0;
}
return isGLFWReady;
}
}
public static void glfwTerminate() {
public static void glfwTerminate() {
mGLFWIsInputReady = false;
CallbackBridge.nativeSetInputReady(false);
long __functionAddress = Functions.Terminate;
invokeV(__functionAddress);
}
}
public static void glfwInitHint(int hint, int value) { }
public static void glfwInitHint(int hint, int value) { }
@NativeType("GLFWwindow *")
public static long glfwGetCurrentContext() {
@ -835,27 +835,16 @@ public class GLFW
return invokeP(__functionAddress);
}
public static void glfwGetFramebufferSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") IntBuffer width, @Nullable @NativeType("int *") IntBuffer height) {
public static void glfwGetFramebufferSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") IntBuffer width, @Nullable @NativeType("int *") IntBuffer height) {
if (CHECKS) {
checkSafe(width, 1);
checkSafe(height, 1);
}
width.put(internalGetWindow(window).width);
height.put(internalGetWindow(window).height);
}
public static void glfwGetFramebufferSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") int[] width, @Nullable @NativeType("int *") int[] height) {
if (CHECKS) {
// check(window);
checkSafe(width, 1);
checkSafe(height, 1);
}
width[0] = internalGetWindow(window).width;
height[0] = internalGetWindow(window).height;
}
@Nullable
@Nullable
@NativeType("GLFWmonitor **")
public static PointerBuffer glfwGetMonitors() {
PointerBuffer pBuffer = PointerBuffer.allocateDirect(1);
@ -892,33 +881,6 @@ public class GLFW
height.put(mGLFWWindowHeight);
}
public static void glfwGetMonitorPos(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] xpos, @Nullable @NativeType("int *") int[] ypos) {
if (CHECKS) {
// check(monitor);
checkSafe(xpos, 1);
checkSafe(ypos, 1);
}
xpos[0] = 0;
ypos[0] = 0;
}
/** Array version of: {@link #glfwGetMonitorWorkarea GetMonitorWorkarea} */
public static void glfwGetMonitorWorkarea(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] xpos, @Nullable @NativeType("int *") int[] ypos, @Nullable @NativeType("int *") int[] width, @Nullable @NativeType("int *") int[] height) {
if (CHECKS) {
// check(monitor);
checkSafe(xpos, 1);
checkSafe(ypos, 1);
checkSafe(width, 1);
checkSafe(height, 1);
}
xpos[0] = 0;
ypos[0] = 0;
width[0] = mGLFWWindowWidth;
height[0] = mGLFWWindowHeight;
}
@NativeType("GLFWmonitor *")
public static long glfwGetWindowMonitor(@NativeType("GLFWwindow *") long window) {
return mGLFWWindowMonitor;
@ -1328,4 +1290,140 @@ return false;
public static boolean glfwGetGamepadState(int jid, GLFWGamepadState state) {
return false;
}
/** Array version of: {@link #glfwGetVersion GetVersion} */
public static void glfwGetVersion(@Nullable @NativeType("int *") int[] major, @Nullable @NativeType("int *") int[] minor, @Nullable @NativeType("int *") int[] rev) {
if (CHECKS) {
checkSafe(major, 1);
checkSafe(minor, 1);
checkSafe(rev, 1);
}
major[0] = GLFW_VERSION_MAJOR;
minor[0] = GLFW_VERSION_MINOR;
rev[0] = GLFW_VERSION_REVISION;
}
/** Array version of: {@link #glfwGetMonitorPos GetMonitorPos} */
public static void glfwGetMonitorPos(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] xpos, @Nullable @NativeType("int *") int[] ypos) {
if (CHECKS) {
// check(monitor);
checkSafe(xpos, 1);
checkSafe(ypos, 1);
}
xpos[0] = 0;
ypos[0] = 0;
}
/** Array version of: {@link #glfwGetMonitorWorkarea GetMonitorWorkarea} */
public static void glfwGetMonitorWorkarea(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] xpos, @Nullable @NativeType("int *") int[] ypos, @Nullable @NativeType("int *") int[] width, @Nullable @NativeType("int *") int[] height) {
if (CHECKS) {
// check(monitor);
checkSafe(xpos, 1);
checkSafe(ypos, 1);
checkSafe(width, 1);
checkSafe(height, 1);
}
xpos[0] = 0;
ypos[0] = 0;
width[0] = mGLFWWindowWidth;
height[0] = mGLFWWindowHeight;
}
/** Array version of: {@link #glfwGetMonitorPhysicalSize GetMonitorPhysicalSize} */
/*
public static void glfwGetMonitorPhysicalSize(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("int *") int[] widthMM, @Nullable @NativeType("int *") int[] heightMM) {
long __functionAddress = Functions.GetMonitorPhysicalSize;
if (CHECKS) {
// check(monitor);
checkSafe(widthMM, 1);
checkSafe(heightMM, 1);
}
invokePPPV(monitor, widthMM, heightMM, __functionAddress);
}
*/
/** Array version of: {@link #glfwGetMonitorContentScale GetMonitorContentScale} */
/*
public static void glfwGetMonitorContentScale(@NativeType("GLFWmonitor *") long monitor, @Nullable @NativeType("float *") float[] xscale, @Nullable @NativeType("float *") float[] yscale) {
long __functionAddress = Functions.GetMonitorContentScale;
if (CHECKS) {
// check(monitor);
checkSafe(xscale, 1);
checkSafe(yscale, 1);
}
invokePPPV(monitor, xscale, yscale, __functionAddress);
}
*/
/** Array version of: {@link #glfwGetWindowPos GetWindowPos} */
public static void glfwGetWindowPos(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") int[] xpos, @Nullable @NativeType("int *") int[] ypos) {
if (CHECKS) {
// check(window);
checkSafe(xpos, 1);
checkSafe(ypos, 1);
}
xpos[0] = 0;
ypos[0] = 0;
}
/** Array version of: {@link #glfwGetWindowSize GetWindowSize} */
public static void glfwGetWindowSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") int[] width, @Nullable @NativeType("int *") int[] height) {
if (CHECKS) {
// check(window);
checkSafe(width, 1);
checkSafe(height, 1);
}
width[0] = internalGetWindow(window).width;
height[0] = internalGetWindow(window).height;
}
/** Array version of: {@link #glfwGetFramebufferSize GetFramebufferSize} */
public static void glfwGetFramebufferSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") int[] width, @Nullable @NativeType("int *") int[] height) {
if (CHECKS) {
// check(window);
checkSafe(width, 1);
checkSafe(height, 1);
}
width[0] = internalGetWindow(window).width;
height[0] = internalGetWindow(window).height;
}
/** Array version of: {@link #glfwGetWindowFrameSize GetWindowFrameSize} */
public static void glfwGetWindowFrameSize(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("int *") int[] left, @Nullable @NativeType("int *") int[] top, @Nullable @NativeType("int *") int[] right, @Nullable @NativeType("int *") int[] bottom) {
if (CHECKS) {
// check(window);
checkSafe(left, 1);
checkSafe(top, 1);
checkSafe(right, 1);
checkSafe(bottom, 1);
}
left[0] = top[0] = 0;
right[0] = internalGetWindow(window).width;
bottom[0] = internalGetWindow(window).height;
}
/** Array version of: {@link #glfwGetWindowContentScale GetWindowContentScale} */
/*
public static void glfwGetWindowContentScale(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("float *") float[] xscale, @Nullable @NativeType("float *") float[] yscale) {
long __functionAddress = Functions.GetWindowContentScale;
if (CHECKS) {
// check(window);
checkSafe(xscale, 1);
checkSafe(yscale, 1);
}
invokePPPV(window, xscale, yscale, __functionAddress);
}
*/
/** Array version of: {@link #glfwGetCursorPos GetCursorPos} */
public static void glfwGetCursorPos(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("double *") double[] xpos, @Nullable @NativeType("double *") double[] ypos) {
if (CHECKS) {
// check(window);
checkSafe(xpos, 1);
checkSafe(ypos, 1);
}
xpos[0] = mGLFWCursorX;
ypos[0] = mGLFWCursorY;
}
}