0

what is the wrong of this code lwjgl with java !!

i want show window but i cant what happens please help me # this code just for showing window i have 2 classes 1- main 2- window MAIN : 1package main; import org.lwjgl.glfw.GLFW; // import engine.io.window; public class main implements Runnable { public Thread game; public static window window; public static final int WIDTH = 1280, HEIGHT = 760; public void start() { game = new Thread(this, "game"); game.start(); } public static void init() { window = new window(WIDTH, HEIGHT, "Game"); window.create(); } public void run() { init(); while (window.shouldClose()) { update(); render(); } } private void update() { window.update(); } private void render() { window.swapBuffers(); } public static void main(String[] args) { new main().start(); } } WINDOW : package engine.io; import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFWVidMode; public class window { private int width, height; private String title; private long window; public int frames; public static long time; public window(int width, int height, String title) { this.width = width; this.height = height; this.title = title; } public void create() { if (!GLFW.glfwInit()) { System.err.println("ERROR: GLFW wasn't initializied"); return; } window = GLFW.glfwCreateWindow(width, height, title, 0, 0); if (window == 0) { System.err.println("ERROR: Window wasn't created"); return; } GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor()); GLFW.glfwSetWindowPos(window, (videoMode.width() - width) / 2, (videoMode.height() - height) / 2); GLFW.glfwMakeContextCurrent(window); //createCallbacks(); GLFW.glfwShowWindow(window); GLFW.glfwSwapInterval(1); time = System.currentTimeMillis(); } public void update() { GLFW.glfwPollEvents(); frames++; if (System.currentTimeMillis() > time + 1000) { GLFW.glfwSetWind

25th Mar 2020, 9:18 AM
faisal
1 ответ
0
Hello faisal Unfortunately I am not familiar with this library. But I found this: https://www.lwjgl.org/guide Maybe it helps you.
6th Apr 2020, 12:02 PM
Denise Roßberg
Denise Roßberg - avatar