LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: lainmaster on September 10, 2009, 01:02:16

Title: Make default cursor invisible without grabbing it?
Post by: lainmaster on September 10, 2009, 01:02:16
?
Title: Re: Make default cursor invisible without grabbing it?
Post by: kappa on September 10, 2009, 01:22:37
use blank image with following method (http://lwjgl.org/javadoc/org/lwjgl/input/Mouse.html#setNativeCursor(org.lwjgl.input.Cursor))
Title: Re: Make default cursor invisible without grabbing it?
Post by: lainmaster on September 10, 2009, 01:34:16
Thanks =D
Title: Re: Make default cursor invisible without grabbing it?
Post by: lainmaster on September 10, 2009, 20:58:42
Okay, works nice, but how can I tell whenever the cursor exits the window?
Title: Re: Make default cursor invisible without grabbing it?
Post by: kappa on September 10, 2009, 21:53:13
you can't atm, you'll just have to do some manual hacking like detecting if the mouse.getX(),getY() has changed.

This is a much requested feature for LWJGL, maybe it will be added sometime in the future, your also free to write a patch.
Title: Re: Make default cursor invisible without grabbing it?
Post by: lainmaster on September 10, 2009, 22:10:28
I don't find it possible to do such hack, since Mouse.GetX/Y returns last when it still was inside the window, and I cannot tell where the mouse was going.
Maybe I can still get the Mouse position on screen, and the Left/Top position of the GL Window? How could I do that? (In particular, the second)

About telling when the mouse exits an area, I used to know how to do this in Visual Basic 6 using Window's API, I'll check out LWJGL's source and see if I can help.
Title: Re: Make default cursor invisible without grabbing it?
Post by: kappa on September 10, 2009, 22:19:38
you could also try java's AWT Robot class, and get the screen coordinates of the mouse and then calculate if its in or outside the window.
Title: Re: Make default cursor invisible without grabbing it?
Post by: lainmaster on September 10, 2009, 22:23:29
How can I tell what the position of the window is?
Title: Re: Make default cursor invisible without grabbing it?
Post by: Matzon on September 11, 2009, 04:49:20
I have a working solution for tracking if mouse left and also if mouse is to the left or below of the window when outside and dragging. I will commit it shortly, but I need to talk to people on irc first since the latter requires an API change (we must stop clipping value to 0).

furthermore - any api changes must also be done in mac and linux - for which I have no code currently.
Title: Re: Make default cursor invisible without grabbing it?
Post by: lainmaster on September 11, 2009, 11:07:53
It would be a nice addition to 2.2.1. : D It'd be nice to just do Mouse.isOut() or Mouse.eventOutOfBounds() Or something of the sort.
Title: Re: Make default cursor invisible without grabbing it?
Post by: princec on September 11, 2009, 15:23:24
Please don't break any existing code! If you're going to do that then enable the behaviour with a commandline switch.

Cas :)