glfwGetVideoMode(glfwGetPrimaryMonitor())不工作

glfwGetVideoMode(glfwGetPrimaryMonitor()) not working

所以我正在观看 java 的教程,内容是关于如何使用 Lwjgl 创建 window,然后我看到了获得主监视器的部分:

    ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    glfwSetWindowPos(
            window,
            (GLFWVidMode.width(vidmode) - width) / 2,
            (GLFWVidMode.height(vidmode) - height) / 2
        ); 

但是我在 eclipse 上遇到这个错误:"Type mismatch: cannot convert from GLFWVidMode to ByteBuffer"

导致不允许这样做: GLFWVidMode.width GLFWVidMode.height(表示:"The method height() in the type GLFWVidMode is not applicable for the arguments (ByteBuffer)")

我搜索了另一个教程,它也按顺序使用了这些方法,所以我不确定我应该替换什么才能让它工作,或者他们是否更新了 Lwjgl 3.0 中的某些内容。

没关系,我检查了源站点,实际上他们更改了它,所以现在是这样的:

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    glfwSetWindowPos(
            window,
             (vidmode.width() - width) / 2,
            (vidmode.height() - height) / 2
        );