replace libWCF with LWJGL 3
This commit is contained in:
parent
9ea6db267e
commit
7f32e87ef4
5 changed files with 559 additions and 121 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,5 @@
|
||||||
/java/bin
|
/java/bin
|
||||||
/java/dev
|
/java/dev
|
||||||
/jdk
|
/jdk
|
||||||
/java/data/libwcf.so
|
|
||||||
/export
|
/export
|
||||||
/.metadata
|
/.metadata
|
||||||
|
|
|
@ -1941,8 +1941,8 @@ public class Game implements IThreadListener {
|
||||||
focus(event.param1 != 0);
|
focus(event.param1 != 0);
|
||||||
break;
|
break;
|
||||||
case KEY:
|
case KEY:
|
||||||
if(event.param1 > 0 && event.param1 <= Keysym.values().length)
|
if(event.param1 >= 0 && event.param1 < Keysym.values().length)
|
||||||
key(Keysym.values()[event.param1 - 1], KeyEvent.values()[event.param2 % KeyEvent.values().length]);
|
key(Keysym.values()[event.param1], KeyEvent.values()[event.param2 % KeyEvent.values().length]);
|
||||||
break;
|
break;
|
||||||
case POSITION:
|
case POSITION:
|
||||||
pos(event.param1, event.param2);
|
pos(event.param1, event.param2);
|
||||||
|
@ -2650,6 +2650,7 @@ public class Game implements IThreadListener {
|
||||||
});
|
});
|
||||||
Thread.currentThread().setName("Render thread");
|
Thread.currentThread().setName("Render thread");
|
||||||
INSTANCE.run();
|
INSTANCE.run();
|
||||||
|
WCF.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ public class GuiInfo extends Gui {
|
||||||
TextColor.CYAN + "Geschrieben von Sen dem \"kleinen\" Dämonen " + TextColor.CRIMSON + TextColor.DEMON + TextColor.BLACK + TextColor.BLKHEART + "\n" +
|
TextColor.CYAN + "Geschrieben von Sen dem \"kleinen\" Dämonen " + TextColor.CRIMSON + TextColor.DEMON + TextColor.BLACK + TextColor.BLKHEART + "\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
TextColor.YELLOW + "Verwendete Programmbibliotheken:" + "\n" +
|
TextColor.YELLOW + "Verwendete Programmbibliotheken:" + "\n" +
|
||||||
TextColor.LGRAY + " -> " + TextColor.NEON + "axe_ork (Modifiziert: GLFW 3.3.8)" + "\n" +
|
TextColor.LGRAY + " -> " + TextColor.NEON + "LWJGL 3.3.6+1 (GLFW + OpenGL)" + "\n" +
|
||||||
TextColor.LGRAY + " -> " + TextColor.NEON + "opl3 (Modifiziert: Nuked-OPL3 f2c9873)" + "\n" +
|
|
||||||
TextColor.LGRAY + " -> " + TextColor.NEON + "nionet (Modifiziert: Netty 4.0.23-Final)" + "\n" +
|
TextColor.LGRAY + " -> " + TextColor.NEON + "nionet (Modifiziert: Netty 4.0.23-Final)" + "\n" +
|
||||||
TextColor.LGRAY + " -> " + TextColor.NEON + "collectutil + futureutil (Modifiziert: Guava 17.0)" + "\n" +
|
TextColor.LGRAY + " -> " + TextColor.NEON + "collectutil + futureutil (Modifiziert: Guava 17.0)" + "\n" +
|
||||||
TextColor.LGRAY + " -> " + TextColor.NEON + "tjglu (Modifiziert: LWJGL 2.9.4-nightly-20150209)" + "\n" +
|
TextColor.LGRAY + " -> " + TextColor.NEON + "tjglu (Modifiziert: LWJGL 2.9.4-nightly-20150209)" + "\n" +
|
||||||
|
|
|
@ -136,6 +136,6 @@ public enum Keysym implements Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean read() {
|
public boolean read() {
|
||||||
return WCF.getKey(this.ordinal() + 1);
|
return WCF.getKey(this); // .ordinal() + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,37 @@
|
||||||
package game.window;
|
package game.window;
|
||||||
|
|
||||||
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
|
import static org.lwjgl.glfw.Callbacks.*;
|
||||||
|
import static org.lwjgl.system.MemoryUtil.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.lwjgl.BufferUtils;
|
||||||
|
import org.lwjgl.Version;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.lwjgl.glfw.GLFWCharCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWCursorPosCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWErrorCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWImage;
|
||||||
|
import org.lwjgl.glfw.GLFWKeyCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWMouseButtonCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWScrollCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWVidMode;
|
||||||
|
import org.lwjgl.glfw.GLFWWindowCloseCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWWindowFocusCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWWindowPosCallback;
|
||||||
|
import org.lwjgl.glfw.GLFWWindowRefreshCallback;
|
||||||
|
import org.lwjgl.opengl.GL;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL13;
|
||||||
|
import org.lwjgl.opengl.GL14;
|
||||||
|
import org.lwjgl.opengl.GL15;
|
||||||
|
import org.lwjgl.system.APIUtil;
|
||||||
|
|
||||||
|
import game.log.Log;
|
||||||
|
|
||||||
public abstract class WCF {
|
public abstract class WCF {
|
||||||
public static final int GL_EXP = 0x800;
|
public static final int GL_EXP = 0x800;
|
||||||
public static final int GL_LIGHT_MODEL_AMBIENT = 0xB53;
|
public static final int GL_LIGHT_MODEL_AMBIENT = 0xB53;
|
||||||
|
@ -355,160 +387,562 @@ public abstract class WCF {
|
||||||
public static final int GL_QUERY_RESULT = 0x8866;
|
public static final int GL_QUERY_RESULT = 0x8866;
|
||||||
public static final int GL_QUERY_RESULT_AVAILABLE = 0x8867;
|
public static final int GL_QUERY_RESULT_AVAILABLE = 0x8867;
|
||||||
public static final int GL_ARRAY_BUFFER = 0x8892;
|
public static final int GL_ARRAY_BUFFER = 0x8892;
|
||||||
|
public static final int GL_STATIC_DRAW = 0x88E4;
|
||||||
|
|
||||||
public static native void glAlphaFunc(int func, float ref);
|
public static void glAlphaFunc(int func, float ref) {
|
||||||
public static native void glBindTexture(int texture);
|
GL11.glAlphaFunc(func, ref);
|
||||||
public static native void glBlendFunc(int sfactor, int dfactor);
|
}
|
||||||
public static native void glCallList(int list);
|
public static void glBindTexture(int texture) {
|
||||||
public static native void glClear(int mask);
|
GL11.glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
public static native void glClearColor(float red, float green, float blue, float alpha);
|
}
|
||||||
public static native void glClearDepth(double depth);
|
public static void glBlendFunc(int sfactor, int dfactor) {
|
||||||
public static native void glColor4f(float red, float green, float blue, float alpha);
|
GL11.glBlendFunc(sfactor, dfactor);
|
||||||
public static native void glColorMask(boolean red, boolean green, boolean blue, boolean alpha);
|
}
|
||||||
public static native void glColorMaterial(int face, int mode);
|
public static void glCallList(int list) {
|
||||||
public static native void glColorPointer(int size, int type, int stride, long pointer);
|
GL11.glCallList(list);
|
||||||
public static native void glCullFace(int mode);
|
}
|
||||||
public static native void glDeleteLists(int list, int range);
|
public static void glClear(int mask) {
|
||||||
public static native void glDeleteTextures(int texture);
|
GL11.glClear(mask);
|
||||||
public static native void glDepthFunc(int func);
|
}
|
||||||
public static native void glDepthMask(boolean flag);
|
public static void glClearColor(float red, float green, float blue, float alpha) {
|
||||||
public static native void glDisable(int cap);
|
GL11.glClearColor(red, green, blue, alpha);
|
||||||
public static native void glDisableClientState(int cap);
|
}
|
||||||
public static native void glDrawArrays(int mode, int first, int count);
|
public static void glClearDepth(double depth) {
|
||||||
public static native void glEnable(int cap);
|
GL11.glClearDepth(depth);
|
||||||
public static native void glEnableClientState(int cap);
|
}
|
||||||
public static native void glEndList();
|
public static void glColor4f(float red, float green, float blue, float alpha) {
|
||||||
public static native void glFogf(int pname, float param);
|
GL11.glColor4f(red, green, blue, alpha);
|
||||||
private static native void glFogfv(int pname, long params);
|
}
|
||||||
public static native void glFogi(int pname, int param);
|
public static void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||||
public static native int glGenLists(int range);
|
GL11.glColorMask(red, green, blue, alpha);
|
||||||
public static native int glGenTextures();
|
}
|
||||||
private static native void glGetFloatv(int pname, long params);
|
public static void glColorMaterial(int face, int mode) {
|
||||||
private static native void glGetIntegerv(long params);
|
GL11.glColorMaterial(face, mode);
|
||||||
private static native void glLightfv(int light, int pname, long params);
|
}
|
||||||
private static native void glLightModelfv(int pname, long params);
|
public static void glColorPointer(int size, int type, int stride, long pointer) {
|
||||||
public static native void glLineWidth(float width);
|
GL11.nglColorPointer(size, type, stride, pointer);
|
||||||
public static native void glLoadIdentity();
|
}
|
||||||
public static native void glMatrixMode(int mode);
|
public static void glCullFace(int mode) {
|
||||||
private static native void glMultMatrixf(long m);
|
GL11.glCullFace(mode);
|
||||||
public static native void glNewList(int list, int mode);
|
}
|
||||||
public static native void glNormal3f(float nx, float ny, float nz);
|
public static void glDeleteLists(int list, int range) {
|
||||||
private static native void glNormalPointer(int type, int stride, long pointer);
|
GL11.glDeleteLists(list, range);
|
||||||
public static native void glPolygonOffset(float factor, float units);
|
}
|
||||||
public static native void glPopMatrix();
|
public static void glDeleteTextures(int texture) {
|
||||||
public static native void glPushMatrix();
|
GL11.glDeleteTextures(texture);
|
||||||
public static native void glRotatef(float angle, float x, float y, float z);
|
}
|
||||||
public static native void glScalef(float x, float y, float z);
|
public static void glDepthFunc(int func) {
|
||||||
public static native void glShadeModel(int mode);
|
GL11.glDepthFunc(func);
|
||||||
public static native void glTexCoordPointer(int size, int type, int stride, long pointer);
|
}
|
||||||
public static native void glTexImage2D(int width, int height);
|
public static void glDepthMask(boolean flag) {
|
||||||
public static native void glTexParameteri(int pname, int param);
|
GL11.glDepthMask(flag);
|
||||||
private static native void glTexSubImage2D(int xoffset, int yoffset, int width, int height, long pixels);
|
}
|
||||||
public static native void glTranslatef(float x, float y, float z);
|
public static void glDisable(int cap) {
|
||||||
public static native void glVertexPointer(int size, int type, int stride, long pointer);
|
GL11.glDisable(cap);
|
||||||
|
}
|
||||||
public static native void glActiveTexture(int texture);
|
public static void glDisableClientState(int cap) {
|
||||||
public static native void glClientActiveTexture(int texture);
|
GL11.glDisableClientState(cap);
|
||||||
public static native void glMultiTexCoord2f(int target, float s, float t);
|
}
|
||||||
|
public static void glDrawArrays(int mode, int first, int count) {
|
||||||
public static native void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha);
|
GL11.glDrawArrays(mode, first, count);
|
||||||
|
}
|
||||||
public static native void glBindBuffer(int buffer);
|
public static void glEnable(int cap) {
|
||||||
public static native void glDeleteBuffers(int buffer);
|
GL11.glEnable(cap);
|
||||||
public static native int glGenBuffers();
|
}
|
||||||
private static native void glBufferData(long data_size, long data);
|
public static void glEnableClientState(int cap) {
|
||||||
|
GL11.glEnableClientState(cap);
|
||||||
public static native void glOrtho(double left, double right, double bottom, double top, double near, double far);
|
}
|
||||||
public static native String glGetString(int id);
|
public static void glEndList() {
|
||||||
public static native void glScissor(int x, int y, int w, int h);
|
GL11.glEndList();
|
||||||
public static native void glViewport(int x, int y, int w, int h);
|
}
|
||||||
private static native void glReadPixels(int x, int y, long data);
|
public static void glFogf(int pname, float param) {
|
||||||
public static native void glPolygonMode(boolean line);
|
GL11.glFogf(pname, param);
|
||||||
public static native void glFlush();
|
}
|
||||||
|
public static void glFogi(int pname, int param) {
|
||||||
|
GL11.glFogi(pname, param);
|
||||||
public static native long getTime();
|
}
|
||||||
private static native int[] pollEvents();
|
public static int glGenLists(int range) {
|
||||||
public static native void setWindowed(int xpos, int ypos, int xsize, int ysize);
|
return GL11.glGenLists(range);
|
||||||
public static native void setFullscreen(int width, int height, int refresh);
|
}
|
||||||
public static native boolean getKey(int code);
|
public static int glGenTextures() {
|
||||||
public static native void setTitle(String title);
|
return GL11.glGenTextures();
|
||||||
public static native void setIcon(byte[] icon, int w, int h);
|
}
|
||||||
public static native String getClipboard();
|
public static void glLineWidth(float width) {
|
||||||
public static native void setClipboard(String text);
|
GL11.glLineWidth(width);
|
||||||
public static native void swapBuffers();
|
}
|
||||||
public static native void grabCursor(boolean grab);
|
public static void glLoadIdentity() {
|
||||||
public static native void setVSync(boolean sync);
|
GL11.glLoadIdentity();
|
||||||
private static native int[] getModes();
|
}
|
||||||
private static native int[] getMode();
|
public static void glMatrixMode(int mode) {
|
||||||
public static native boolean createWindow(String id, boolean gldebug);
|
GL11.glMatrixMode(mode);
|
||||||
public static native void destroyWindow();
|
}
|
||||||
public static native void initWindow(int sx, int sy, int wx, int wy);
|
public static void glNewList(int list, int mode) {
|
||||||
|
GL11.glNewList(list, mode);
|
||||||
public static void glBufferData(java.nio.ByteBuffer data) {
|
}
|
||||||
glBufferData(data.remaining(), ((sun.nio.ch.DirectBuffer)data).address() + data.position());
|
public static void glNormal3f(float nx, float ny, float nz) {
|
||||||
|
GL11.glNormal3f(nx, ny, nz);
|
||||||
|
}
|
||||||
|
public static void glPolygonOffset(float factor, float units) {
|
||||||
|
GL11.glPolygonOffset(factor, units);
|
||||||
|
}
|
||||||
|
public static void glPopMatrix() {
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
public static void glPushMatrix() {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
}
|
||||||
|
public static void glRotatef(float angle, float x, float y, float z) {
|
||||||
|
GL11.glRotatef(angle, x, y, z);
|
||||||
|
}
|
||||||
|
public static void glScalef(float x, float y, float z) {
|
||||||
|
GL11.glScalef(x, y, z);
|
||||||
|
}
|
||||||
|
public static void glShadeModel(int mode) {
|
||||||
|
GL11.glShadeModel(mode);
|
||||||
|
}
|
||||||
|
public static void glTexCoordPointer(int size, int type, int stride, long pointer) {
|
||||||
|
GL11.glTexCoordPointer(size, type, stride, pointer);
|
||||||
|
}
|
||||||
|
public static void glTexImage2D(int width, int height) {
|
||||||
|
GL11.nglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||||
|
}
|
||||||
|
public static void glTexParameteri(int pname, int param) {
|
||||||
|
GL11.glTexParameteri(GL_TEXTURE_2D, pname, param);
|
||||||
|
}
|
||||||
|
public static void glTranslatef(float x, float y, float z) {
|
||||||
|
GL11.glTranslatef(x, y, z);
|
||||||
|
}
|
||||||
|
public static void glVertexPointer(int size, int type, int stride, long pointer) {
|
||||||
|
GL11.nglVertexPointer(size, type, stride, pointer);
|
||||||
|
}
|
||||||
|
public static void glOrtho(double left, double right, double bottom, double top, double near, double far) {
|
||||||
|
GL11.glOrtho(left, right, bottom, top, near, far);
|
||||||
|
}
|
||||||
|
public static String glGetString(int id) {
|
||||||
|
return GL11.glGetString(id);
|
||||||
|
}
|
||||||
|
public static void glScissor(int x, int y, int w, int h) {
|
||||||
|
GL11.glScissor(x, y, w, h);
|
||||||
|
}
|
||||||
|
public static void glViewport(int x, int y, int w, int h) {
|
||||||
|
GL11.glViewport(x, y, w, h);
|
||||||
|
}
|
||||||
|
public static void glPolygonMode(boolean line) {
|
||||||
|
GL11.glPolygonMode(GL_FRONT_AND_BACK, line ? GL_LINE : GL_FILL);
|
||||||
|
}
|
||||||
|
public static void glFlush() {
|
||||||
|
GL11.glFlush();
|
||||||
}
|
}
|
||||||
public static void glColorPointer(int size, int type, int stride, java.nio.ByteBuffer pointer) {
|
public static void glColorPointer(int size, int type, int stride, java.nio.ByteBuffer pointer) {
|
||||||
glColorPointer(size, type, stride, ((sun.nio.ch.DirectBuffer)pointer).address() + pointer.position());
|
GL11.glColorPointer(size, type, stride, pointer);
|
||||||
}
|
}
|
||||||
public static void glFog(int pname, java.nio.FloatBuffer params) {
|
public static void glFog(int pname, java.nio.FloatBuffer params) {
|
||||||
glFogfv(pname, ((sun.nio.ch.DirectBuffer)params).address() + (params.position() << 2));
|
GL11.glFogfv(pname, params);
|
||||||
}
|
}
|
||||||
public static void glGetFloat(int pname, java.nio.FloatBuffer params) {
|
public static void glGetFloat(int pname, java.nio.FloatBuffer params) {
|
||||||
glGetFloatv(pname, ((sun.nio.ch.DirectBuffer)params).address() + (params.position() << 2));
|
GL11.glGetFloatv(pname, params);
|
||||||
}
|
}
|
||||||
public static void glGetInteger(java.nio.IntBuffer params) {
|
public static void glGetInteger(java.nio.IntBuffer params) {
|
||||||
glGetIntegerv(((sun.nio.ch.DirectBuffer)params).address() + (params.position() << 2));
|
GL11.glGetIntegerv(GL_VIEWPORT, params);
|
||||||
}
|
}
|
||||||
public static void glLight(int light, int pname, java.nio.FloatBuffer params) {
|
public static void glLight(int light, int pname, java.nio.FloatBuffer params) {
|
||||||
glLightfv(light, pname, ((sun.nio.ch.DirectBuffer)params).address() + (params.position() << 2));
|
GL11.glLightfv(light, pname, params);
|
||||||
}
|
}
|
||||||
public static void glLightModel(int pname, java.nio.FloatBuffer params) {
|
public static void glLightModel(int pname, java.nio.FloatBuffer params) {
|
||||||
glLightModelfv(pname, ((sun.nio.ch.DirectBuffer)params).address() + (params.position() << 2));
|
GL11.glLightModelfv(pname, params);
|
||||||
}
|
}
|
||||||
public static void glMultMatrix(java.nio.FloatBuffer m) {
|
public static void glMultMatrix(java.nio.FloatBuffer m) {
|
||||||
glMultMatrixf(((sun.nio.ch.DirectBuffer)m).address() + (m.position() << 2));
|
GL11.glMultMatrixf(m);
|
||||||
}
|
}
|
||||||
public static void glNormalPointer(int type, int stride, java.nio.ByteBuffer pointer) {
|
public static void glNormalPointer(int type, int stride, java.nio.ByteBuffer pointer) {
|
||||||
glNormalPointer(type, stride, ((sun.nio.ch.DirectBuffer)pointer).address() + pointer.position());
|
GL11.glNormalPointer(type, stride, pointer);
|
||||||
}
|
}
|
||||||
public static void glTexCoordPointer(int size, int type, int stride, java.nio.ByteBuffer pointer) {
|
public static void glTexCoordPointer(int size, int type, int stride, java.nio.ByteBuffer pointer) {
|
||||||
glTexCoordPointer(size, type, stride, ((sun.nio.ch.DirectBuffer)pointer).address() + pointer.position());
|
GL11.glTexCoordPointer(size, type, stride, pointer);
|
||||||
}
|
}
|
||||||
public static void glTexSubImage2D(int xoffset, int yoffset, int width, int height, java.nio.IntBuffer pixels) {
|
public static void glTexSubImage2D(int xoffset, int yoffset, int width, int height, java.nio.IntBuffer pixels) {
|
||||||
glTexSubImage2D(xoffset, yoffset, width, height, ((sun.nio.ch.DirectBuffer)pixels).address() + (pixels.position() << 2));
|
GL11.glTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pixels);
|
||||||
}
|
}
|
||||||
public static void glVertexPointer(int size, int type, int stride, java.nio.ByteBuffer pointer) {
|
public static void glVertexPointer(int size, int type, int stride, java.nio.ByteBuffer pointer) {
|
||||||
glVertexPointer(size, type, stride, ((sun.nio.ch.DirectBuffer)pointer).address() + pointer.position());
|
GL11.glVertexPointer(size, type, stride, pointer);
|
||||||
}
|
}
|
||||||
public static void glReadPixels(int x, int y, java.nio.ByteBuffer data) {
|
public static void glReadPixels(int x, int y, java.nio.ByteBuffer data) {
|
||||||
glReadPixels(x, y, ((sun.nio.ch.DirectBuffer)data).address() + data.position());
|
GL11.glReadPixels(0, 0, x, y, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void glActiveTexture(int texture) {
|
||||||
|
GL13.glActiveTexture(texture);
|
||||||
|
}
|
||||||
|
public static void glClientActiveTexture(int texture) {
|
||||||
|
GL13.glClientActiveTexture(texture);
|
||||||
|
}
|
||||||
|
public static void glMultiTexCoord2f(int target, float s, float t) {
|
||||||
|
GL13.glMultiTexCoord2f(target, s, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha) {
|
||||||
|
GL14.glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void glBindBuffer(int buffer) {
|
||||||
|
GL15.glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||||
|
}
|
||||||
|
public static void glDeleteBuffers(int buffer) {
|
||||||
|
GL15.glDeleteBuffers(buffer);
|
||||||
|
}
|
||||||
|
public static int glGenBuffers() {
|
||||||
|
return GL15.glGenBuffers();
|
||||||
|
}
|
||||||
|
public static void glBufferData(java.nio.ByteBuffer data) {
|
||||||
|
GL15.glBufferData(GL_ARRAY_BUFFER, data, GL_STATIC_DRAW);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getTime() {
|
||||||
|
return glfwGetTimerValue() / (glfwGetTimerFrequency() / 1000000L);
|
||||||
|
}
|
||||||
|
public static void setWindowed(int xpos, int ypos, int xsize, int ysize) {
|
||||||
|
if(window != NULL)
|
||||||
|
glfwSetWindowMonitor(window, NULL, xpos, ypos, xsize, ysize, GLFW_DONT_CARE);
|
||||||
|
}
|
||||||
|
public static void setFullscreen(int width, int height, int refresh) {
|
||||||
|
if(window != NULL) {
|
||||||
|
long monitor = glfwGetPrimaryMonitor();
|
||||||
|
if(monitor != NULL)
|
||||||
|
glfwSetWindowMonitor(window, monitor, 0, 0, width, height, refresh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean getKey(Keysym code) {
|
||||||
|
return window != NULL && glfwGetKey(window, CODES[code.ordinal()]) == GLFW_PRESS;
|
||||||
|
}
|
||||||
|
public static void setTitle(String title) {
|
||||||
|
if(window != NULL)
|
||||||
|
glfwSetWindowTitle(window, title);
|
||||||
|
}
|
||||||
|
public static void setIcon(byte[] icon, int w, int h) {
|
||||||
|
if(window != NULL) {
|
||||||
|
GLFWImage img = GLFWImage.create();
|
||||||
|
img.width(w);
|
||||||
|
img.height(h);
|
||||||
|
// java.nio.ByteBuffer pbuf = ;
|
||||||
|
img.pixels(BufferUtils.createByteBuffer(icon.length).put(icon));
|
||||||
|
// img.pixels(icon.length / 4);
|
||||||
|
GLFWImage.Buffer buf = GLFWImage.create(1).put(img);
|
||||||
|
glfwSetWindowIcon(window, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static String getClipboard() {
|
||||||
|
return window == NULL ? null : glfwGetClipboardString(window);
|
||||||
|
}
|
||||||
|
public static void setClipboard(String text) {
|
||||||
|
if(window != NULL)
|
||||||
|
glfwSetClipboardString(window, text);
|
||||||
|
}
|
||||||
|
public static void swapBuffers() {
|
||||||
|
if(window != NULL)
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
}
|
||||||
|
public static void grabCursor(boolean grab) {
|
||||||
|
if(window != NULL)
|
||||||
|
glfwSetInputMode(window, GLFW_CURSOR, grab ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL);
|
||||||
|
}
|
||||||
|
public static void setVSync(boolean sync) {
|
||||||
|
if(window != NULL)
|
||||||
|
glfwSwapInterval(sync ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int[] CODES = new int[Keysym.values().length];
|
||||||
|
private static final Keysym[] KEYS = new Keysym[GLFW_KEY_LAST];
|
||||||
|
private static final List<WindowEvent> EVENTS = new ArrayList<WindowEvent>();
|
||||||
|
|
||||||
|
private static long window;
|
||||||
|
|
||||||
|
private static void addKey(Keysym key, int code) {
|
||||||
|
CODES[key.ordinal()] = code;
|
||||||
|
KEYS[code - 1] = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
addKey(Keysym.N0, GLFW_KEY_0);
|
||||||
|
addKey(Keysym.N1, GLFW_KEY_1);
|
||||||
|
addKey(Keysym.N2, GLFW_KEY_2);
|
||||||
|
addKey(Keysym.N3, GLFW_KEY_3);
|
||||||
|
addKey(Keysym.N4, GLFW_KEY_4);
|
||||||
|
addKey(Keysym.N5, GLFW_KEY_5);
|
||||||
|
addKey(Keysym.N6, GLFW_KEY_6);
|
||||||
|
addKey(Keysym.N7, GLFW_KEY_7);
|
||||||
|
addKey(Keysym.N8, GLFW_KEY_8);
|
||||||
|
addKey(Keysym.N9, GLFW_KEY_9);
|
||||||
|
|
||||||
|
addKey(Keysym.A, GLFW_KEY_A);
|
||||||
|
addKey(Keysym.B, GLFW_KEY_B);
|
||||||
|
addKey(Keysym.C, GLFW_KEY_C);
|
||||||
|
addKey(Keysym.D, GLFW_KEY_D);
|
||||||
|
addKey(Keysym.E, GLFW_KEY_E);
|
||||||
|
addKey(Keysym.F, GLFW_KEY_F);
|
||||||
|
addKey(Keysym.G, GLFW_KEY_G);
|
||||||
|
addKey(Keysym.H, GLFW_KEY_H);
|
||||||
|
addKey(Keysym.I, GLFW_KEY_I);
|
||||||
|
addKey(Keysym.J, GLFW_KEY_J);
|
||||||
|
addKey(Keysym.K, GLFW_KEY_K);
|
||||||
|
addKey(Keysym.L, GLFW_KEY_L);
|
||||||
|
addKey(Keysym.M, GLFW_KEY_M);
|
||||||
|
addKey(Keysym.N, GLFW_KEY_N);
|
||||||
|
addKey(Keysym.O, GLFW_KEY_O);
|
||||||
|
addKey(Keysym.P, GLFW_KEY_P);
|
||||||
|
addKey(Keysym.Q, GLFW_KEY_Q);
|
||||||
|
addKey(Keysym.R, GLFW_KEY_R);
|
||||||
|
addKey(Keysym.S, GLFW_KEY_S);
|
||||||
|
addKey(Keysym.T, GLFW_KEY_T);
|
||||||
|
addKey(Keysym.U, GLFW_KEY_U);
|
||||||
|
addKey(Keysym.V, GLFW_KEY_V);
|
||||||
|
addKey(Keysym.W, GLFW_KEY_W);
|
||||||
|
addKey(Keysym.X, GLFW_KEY_X);
|
||||||
|
addKey(Keysym.Y, GLFW_KEY_Z);
|
||||||
|
addKey(Keysym.Z, GLFW_KEY_Y);
|
||||||
|
|
||||||
|
addKey(Keysym.F1, GLFW_KEY_F1);
|
||||||
|
addKey(Keysym.F2, GLFW_KEY_F2);
|
||||||
|
addKey(Keysym.F3, GLFW_KEY_F3);
|
||||||
|
addKey(Keysym.F4, GLFW_KEY_F4);
|
||||||
|
addKey(Keysym.F5, GLFW_KEY_F5);
|
||||||
|
addKey(Keysym.F6, GLFW_KEY_F6);
|
||||||
|
addKey(Keysym.F7, GLFW_KEY_F7);
|
||||||
|
addKey(Keysym.F8, GLFW_KEY_F8);
|
||||||
|
addKey(Keysym.F9, GLFW_KEY_F9);
|
||||||
|
addKey(Keysym.F10, GLFW_KEY_F10);
|
||||||
|
addKey(Keysym.F11, GLFW_KEY_F11);
|
||||||
|
addKey(Keysym.F12, GLFW_KEY_F12);
|
||||||
|
|
||||||
|
addKey(Keysym.KP_0, GLFW_KEY_KP_0);
|
||||||
|
addKey(Keysym.KP_1, GLFW_KEY_KP_1);
|
||||||
|
addKey(Keysym.KP_2, GLFW_KEY_KP_2);
|
||||||
|
addKey(Keysym.KP_3, GLFW_KEY_KP_3);
|
||||||
|
addKey(Keysym.KP_4, GLFW_KEY_KP_4);
|
||||||
|
addKey(Keysym.KP_5, GLFW_KEY_KP_5);
|
||||||
|
addKey(Keysym.KP_6, GLFW_KEY_KP_6);
|
||||||
|
addKey(Keysym.KP_7, GLFW_KEY_KP_7);
|
||||||
|
addKey(Keysym.KP_8, GLFW_KEY_KP_8);
|
||||||
|
addKey(Keysym.KP_9, GLFW_KEY_KP_9);
|
||||||
|
|
||||||
|
addKey(Keysym.SPACE, GLFW_KEY_SPACE);
|
||||||
|
addKey(Keysym.CIRCUMFLEX, GLFW_KEY_GRAVE_ACCENT);
|
||||||
|
addKey(Keysym.SHARP_S, GLFW_KEY_MINUS);
|
||||||
|
addKey(Keysym.ACUTE, GLFW_KEY_EQUAL);
|
||||||
|
addKey(Keysym.UE, GLFW_KEY_LEFT_BRACKET);
|
||||||
|
addKey(Keysym.PLUS, GLFW_KEY_RIGHT_BRACKET);
|
||||||
|
addKey(Keysym.OE, GLFW_KEY_SEMICOLON);
|
||||||
|
addKey(Keysym.AE, GLFW_KEY_APOSTROPHE);
|
||||||
|
addKey(Keysym.NUMBER_SIGN, GLFW_KEY_BACKSLASH);
|
||||||
|
addKey(Keysym.LESS_THAN, GLFW_KEY_WORLD_1);
|
||||||
|
addKey(Keysym.COMMA, GLFW_KEY_COMMA);
|
||||||
|
addKey(Keysym.PERIOD, GLFW_KEY_PERIOD);
|
||||||
|
addKey(Keysym.HYPHEN, GLFW_KEY_SLASH);
|
||||||
|
|
||||||
|
addKey(Keysym.KP_DECIMAL, GLFW_KEY_KP_DECIMAL);
|
||||||
|
addKey(Keysym.KP_DIVIDE, GLFW_KEY_KP_DIVIDE);
|
||||||
|
addKey(Keysym.KP_MULTIPLY, GLFW_KEY_KP_MULTIPLY);
|
||||||
|
addKey(Keysym.KP_SUBTRACT, GLFW_KEY_KP_SUBTRACT);
|
||||||
|
addKey(Keysym.KP_ADD, GLFW_KEY_KP_ADD);
|
||||||
|
addKey(Keysym.KP_ENTER, GLFW_KEY_KP_ENTER);
|
||||||
|
addKey(Keysym.KP_EQUAL, GLFW_KEY_KP_EQUAL);
|
||||||
|
|
||||||
|
addKey(Keysym.CAPS_LOCK, GLFW_KEY_CAPS_LOCK);
|
||||||
|
addKey(Keysym.SCROLL_LOCK, GLFW_KEY_SCROLL_LOCK);
|
||||||
|
addKey(Keysym.NUM_LOCK, GLFW_KEY_NUM_LOCK);
|
||||||
|
|
||||||
|
addKey(Keysym.ESCAPE, GLFW_KEY_ESCAPE);
|
||||||
|
addKey(Keysym.RETURN, GLFW_KEY_ENTER);
|
||||||
|
addKey(Keysym.TAB, GLFW_KEY_TAB);
|
||||||
|
addKey(Keysym.BACKSPACE, GLFW_KEY_BACKSPACE);
|
||||||
|
addKey(Keysym.INSERT, GLFW_KEY_INSERT);
|
||||||
|
addKey(Keysym.DELETE, GLFW_KEY_DELETE);
|
||||||
|
addKey(Keysym.RIGHT, GLFW_KEY_RIGHT);
|
||||||
|
addKey(Keysym.LEFT, GLFW_KEY_LEFT);
|
||||||
|
addKey(Keysym.DOWN, GLFW_KEY_DOWN);
|
||||||
|
addKey(Keysym.UP, GLFW_KEY_UP);
|
||||||
|
addKey(Keysym.PAGE_UP, GLFW_KEY_PAGE_UP);
|
||||||
|
addKey(Keysym.PAGE_DOWN, GLFW_KEY_PAGE_DOWN);
|
||||||
|
addKey(Keysym.HOME, GLFW_KEY_HOME);
|
||||||
|
addKey(Keysym.END, GLFW_KEY_END);
|
||||||
|
addKey(Keysym.PRINT_SCREEN, GLFW_KEY_PRINT_SCREEN);
|
||||||
|
addKey(Keysym.PAUSE, GLFW_KEY_PAUSE);
|
||||||
|
addKey(Keysym.LEFT_SHIFT, GLFW_KEY_LEFT_SHIFT);
|
||||||
|
addKey(Keysym.LEFT_CONTROL, GLFW_KEY_LEFT_CONTROL);
|
||||||
|
addKey(Keysym.ALT, GLFW_KEY_LEFT_ALT);
|
||||||
|
addKey(Keysym.LEFT_LINUX, GLFW_KEY_LEFT_SUPER);
|
||||||
|
addKey(Keysym.RIGHT_SHIFT, GLFW_KEY_RIGHT_SHIFT);
|
||||||
|
addKey(Keysym.RIGHT_CONTROL, GLFW_KEY_RIGHT_CONTROL);
|
||||||
|
addKey(Keysym.ALT_GRAPH, GLFW_KEY_RIGHT_ALT);
|
||||||
|
addKey(Keysym.RIGHT_LINUX, GLFW_KEY_RIGHT_SUPER);
|
||||||
|
addKey(Keysym.MENU, GLFW_KEY_MENU);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean createWindow(String id, boolean gldebug) {
|
||||||
|
glfwDefaultWindowHints();
|
||||||
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_DEBUG, gldebug ? GLFW_TRUE : GLFW_FALSE);
|
||||||
|
window = glfwCreateWindow(100, 100, id, NULL, NULL);
|
||||||
|
if(window == NULL) {
|
||||||
|
Log.SYSTEM.error("Konnte kein Fenster für das Programm erstellen");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glfwSetMouseButtonCallback(window, new GLFWMouseButtonCallback() {
|
||||||
|
public void invoke(long window, int button, int action, int mods) {
|
||||||
|
if(action != GLFW_REPEAT && button >= 0 && button < Button.values().length)
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.BUTTON, button, action == GLFW_PRESS ? 1 : 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetCharCallback(window, new GLFWCharCallback() {
|
||||||
|
public void invoke(long window, int codepoint) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.CHARACTER, codepoint, 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetCursorPosCallback(window, new GLFWCursorPosCallback() {
|
||||||
|
public void invoke(long window, double xpos, double ypos) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.CURSOR, (int)xpos, (int)ypos));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetFramebufferSizeCallback(window, new GLFWFramebufferSizeCallback() {
|
||||||
|
public void invoke(long window, int width, int height) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.RESIZE, width, height));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetKeyCallback(window, new GLFWKeyCallback() {
|
||||||
|
public void invoke(long window, int key, int scancode, int action, int mods) {
|
||||||
|
Keysym code = key > 0 && key <= KEYS.length ? KEYS[key - 1] : null;
|
||||||
|
if(code != null)
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.KEY, code.ordinal(),
|
||||||
|
(action == GLFW_PRESS ? KeyEvent.PRESS : (action == GLFW_RELEASE ? KeyEvent.RELEASE : KeyEvent.REPEAT)).ordinal()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetScrollCallback(window, new GLFWScrollCallback() {
|
||||||
|
public void invoke(long window, double xoffset, double yoffset) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.SCROLL, (int)xoffset, (int)yoffset));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetWindowCloseCallback(window, new GLFWWindowCloseCallback() {
|
||||||
|
public void invoke(long window) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.CLOSED, 0, 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetWindowFocusCallback(window, new GLFWWindowFocusCallback() {
|
||||||
|
public void invoke(long window, boolean focused) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.FOCUS, focused ? 1 : 0, 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// glfwSetWindowSizeCallback(window, new GLFWWindowSizeCallback() {
|
||||||
|
// public void invoke(long window, int width, int height) {
|
||||||
|
// EVENTS.add(new WindowEvent(WindowAction.RESIZE, width, height));
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
glfwSetWindowPosCallback(window, new GLFWWindowPosCallback() {
|
||||||
|
public void invoke(long window, int xpos, int ypos) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.POSITION, xpos, ypos));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwSetWindowRefreshCallback(window, new GLFWWindowRefreshCallback() {
|
||||||
|
public void invoke(long window) {
|
||||||
|
EVENTS.add(new WindowEvent(WindowAction.REDRAW, 0, 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
GL.createCapabilities();
|
||||||
|
}
|
||||||
|
return window != NULL;
|
||||||
|
}
|
||||||
|
public static void destroyWindow() {
|
||||||
|
if(window != NULL) {
|
||||||
|
glfwFreeCallbacks(window);
|
||||||
|
glfwDestroyWindow(window);
|
||||||
|
window = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void initWindow(int sx, int sy, int wx, int wy) {
|
||||||
|
if(window == NULL)
|
||||||
|
return;
|
||||||
|
long monitor = glfwGetPrimaryMonitor();
|
||||||
|
GLFWVidMode mode = monitor == NULL ? null : glfwGetVideoMode(monitor);
|
||||||
|
int[] x = new int[1];
|
||||||
|
int[] y = new int[1];
|
||||||
|
if(monitor != NULL)
|
||||||
|
glfwGetMonitorPos(monitor, x, y);
|
||||||
|
int xsize = (mode != null && wx > mode.width()) ? mode.width() : wx;
|
||||||
|
int ysize = (mode != null && wy > mode.height()) ? mode.height() : wy;
|
||||||
|
int xpos = x[0] + (mode != null ? mode.width() / 2 - xsize / 2 : 0);
|
||||||
|
int ypos = y[0] + (mode != null ? mode.height() / 2 - ysize / 2 : 0);
|
||||||
|
xsize = xsize < 1 ? 1 : xsize;
|
||||||
|
ysize = ysize < 1 ? 1 : ysize;
|
||||||
|
if(sx != 0x80000000 && sy != 0x80000000) {
|
||||||
|
xpos = sx;
|
||||||
|
ypos = sy;
|
||||||
|
}
|
||||||
|
if(wx != 0 && wy != 0) {
|
||||||
|
xsize = wx;
|
||||||
|
ysize = wy;
|
||||||
|
}
|
||||||
|
glfwSetWindowSize(window, xsize, ysize);
|
||||||
|
glfwSetWindowPos(window, xpos, ypos);
|
||||||
|
// wcf_windowed(win, xpos, ypos, xsize, ysize);
|
||||||
|
// wcf_fullscreen does not move while hidden ...
|
||||||
|
// wcf_setpos(win, xpos, ypos);
|
||||||
|
glfwShowWindow(window);
|
||||||
|
// wcf_show(win, 1);
|
||||||
|
// wcf_limits(win, 1, 1, -1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
public static WindowEvent[] poll() {
|
public static WindowEvent[] poll() {
|
||||||
int[] data = pollEvents();
|
glfwPollEvents();
|
||||||
WindowEvent[] events = new WindowEvent[data.length / 3];
|
// int[] data = pollEvents();
|
||||||
for(int z = 0; z < events.length; z++) {
|
// WindowEvent[] events = new WindowEvent[data.length / 3];
|
||||||
events[z] = new WindowEvent(WindowAction.values()[data[z * 3 + 0]], data[z * 3 + 1], data[z * 3 + 2]);
|
// for(int z = 0; z < events.length; z++) {
|
||||||
}
|
// events[z] = new WindowEvent(WindowAction.values()[data[z * 3 + 0]], data[z * 3 + 1], data[z * 3 + 2]);
|
||||||
|
// }
|
||||||
|
WindowEvent[] events = EVENTS.toArray(new WindowEvent[EVENTS.size()]);
|
||||||
|
EVENTS.clear();
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
public static DisplayMode[] getDisplayModes() {
|
public static DisplayMode[] getDisplayModes() {
|
||||||
int[] data = getModes();
|
long monitor = glfwGetPrimaryMonitor();
|
||||||
|
GLFWVidMode.Buffer data = monitor == NULL ? null : glfwGetVideoModes(monitor);
|
||||||
|
// int[] data = getModes();
|
||||||
if(data == null)
|
if(data == null)
|
||||||
return null;
|
return null;
|
||||||
DisplayMode[] modes = new DisplayMode[data.length / 3];
|
// modes.forEach(new Consumer<GLFWVidMode>() {
|
||||||
for(int z = 0; z < modes.length; z++) {
|
// public void accept(GLFWVidMode t) {
|
||||||
modes[z] = new DisplayMode(data[z * 3 + 0], data[z * 3 + 1], data[z * 3 + 2]);
|
// // TODO Auto-generated method stub
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
DisplayMode[] modes = new DisplayMode[data.limit()];
|
||||||
|
for(int z = 0; z < data.limit(); z++) {
|
||||||
|
GLFWVidMode mode = data.get(z);
|
||||||
|
modes[z] = new DisplayMode(mode.width(), mode.height(), mode.refreshRate());
|
||||||
}
|
}
|
||||||
return modes;
|
return modes;
|
||||||
}
|
}
|
||||||
public static DisplayMode getDisplayMode() {
|
public static DisplayMode getDisplayMode() {
|
||||||
int[] data = getMode();
|
long monitor = glfwGetPrimaryMonitor();
|
||||||
if(data == null)
|
GLFWVidMode mode = monitor == NULL ? null : glfwGetVideoMode(monitor);
|
||||||
|
// int[] data = getMode();
|
||||||
|
if(mode == null)
|
||||||
return null;
|
return null;
|
||||||
return new DisplayMode(data[0], data[1], data[2]);
|
return new DisplayMode(mode.width(), mode.height(), mode.refreshRate());
|
||||||
}
|
}
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
GLFWErrorCallback.create(new GLFWErrorCallback() {
|
||||||
|
private Map<Integer, String> codes = APIUtil.apiClassTokens((field, value) -> 0x10000 < value && value < 0x20000, null, GLFW.class);
|
||||||
|
|
||||||
|
public void invoke(int error, long description) {
|
||||||
|
Log.SYSTEM.error("LWJGL-Fehler %s: %s", this.codes.get(error), getDescription(description));
|
||||||
|
}
|
||||||
|
}).set();
|
||||||
|
if(!glfwInit())
|
||||||
|
throw new IllegalStateException("Kann GLFW nicht initialisieren");
|
||||||
|
if(glfwGetTimerFrequency() < 1000000L)
|
||||||
|
throw new IllegalStateException("Timer unterstützt keine Mikrosekunden-Präzision");
|
||||||
|
Log.SYSTEM.info("LWJGL " + Version.getVersion());
|
||||||
|
/*
|
||||||
System.setProperty("java.library.path", "lib");
|
System.setProperty("java.library.path", "lib");
|
||||||
try {
|
try {
|
||||||
java.lang.reflect.Field paths = ClassLoader.class.getDeclaredField("sys_paths");
|
java.lang.reflect.Field paths = ClassLoader.class.getDeclaredField("sys_paths");
|
||||||
|
@ -531,5 +965,10 @@ public abstract class WCF {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
System.loadLibrary("wcf");
|
System.loadLibrary("wcf");
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
public static void end() {
|
||||||
|
glfwTerminate();
|
||||||
|
glfwSetErrorCallback(null).free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue