Mouse

Howzit

How do I get the location of the Mouse when you click it?
I tried Mouse.dx but it didn’t really work.

Shot

LWJGL does not keep track of the mouse position. Mouse.dx and Mouse.dy gives you the movement of the mouse since the last poll(). Use this to keep track of the mouse position yourself.

If you use the native cursor, you must start off at the center of the viewPort. You could use this code after setting the native cursor:


                        
                        IntBuffer viewPort = ByteBuffer.allocateDirect(4*4).order(ByteOrder.nativeOrder()).asIntBuffer(); 
                        GL.glGetInteger(GL.GL_VIEWPORT, viewPort);
                        viewPort.rewind();
                        x = viewPort.get(2)/2;
                        y = viewPort.get(3)/2;

x,y is the position of the native cursor. After this you must add Mouse.dx and Mouse.dy to x and y after every poll to keep the position synchronized.

Good luck!