我目前正在尝试找出 make 来为 java 游戏制作窗口(使用 lwjgl 3.3.3)。我遇到的大多数教程都非常过时,因此非常感谢一些帮助(以及一些轻微的解释,因为我是 java 新手)。
我已经尝试了多个教程,但所有教程都已过时,因此如果您可以帮助我或提供一个好的教程,我将不胜感激。
如果我正确理解了问题,创建一个简单的窗口看起来像这样..
glfwInit();
long glfwWindow = glfwCreateWindow(width, height, "Window title", glfwGetPrimaryMonitor(), MemoryUtil.NULL);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwMakeContextCurrent(glfwWindow);
//vsync: 1 on / 0 off
glfwSwapInterval(1);
//display settings
glfwShowWindow(glfwWindow);
//connects library tools
GL.createCapabilities();
//camera
glMatrixMode(GL_PROJECTION);
glOrtho(0, width, 0, height, 1, -1);
glMatrixMode(GL_MODELVIEW);
glClearColor(206f / 255f, 246f / 255f, 1.0f, 1.0f);
while (!glfwWindowShouldClose(glfwWindow)) {
//all draw here
glfwSwapBuffers(glfwWindow);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glfwPollEvents();
}