Search code examples
javacursormouselwjgl

Java lwgjl2 change cursor image


I want to change the Cursor image in Java in my LWJGL project. But so far i only found solutions to do it with a GLFW Window, which i am not using.

I have really no idea how, since any attempt failed. please help


Solution

  • LWJGL 2.9.1

    Cursor cursor = new Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays);
    Mouse.setNativeCursor(cursor);
    

    Also, LWJGL 2 is not supported anymore and you should start using LWJGL 3.
    https://github.com/LWJGL/lwjgl3-wiki/wiki/1.2.-Why-a-new-version