LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: napier on September 27, 2005, 07:26:06

Title: Have to use LWJGL with a touch screen
Post by: napier on September 27, 2005, 07:26:06
I need to get LWJGL running on a touchscreen.  I have code like this to read mouse events:

       int mouseDX = Mouse.getDX();
       int mouseDY = Mouse.getDY();
       if (mouseDX != 0 || mouseDY != 0 || mouseDW != 0) {
           cursorX += mouseDX;
           cursorY += mouseDY;


this doesn't work with touch screen because the user can pick up their finger and place it anywhere.  The mouse always gives continuous delta XY coords, but the touch screen can jump all over, screwing up the delta xy approach.

I need to get absolute screen xy position of input events.  I tried Mouse.getEventX() but it always returns 0.  Is there a way to get absolute xy?
Title: Have to use LWJGL with a touch screen
Post by: elias on September 27, 2005, 10:04:26
getEventX/Y should work if you use Mouse.next(). Alternatively, use getX/Y().

- elias