This kind of call does not belong in JOGL. This is obviously an issue related to the behavior of an input device and if it belongs anywhere it should be in JInput.
I think this cursor locking function is something that only game developers really need. So it doesn’t belong in a graphics API or an input API. It belongs in a game API. Problem is, there’s no catch-all framework like SDL on the Java platform – yet – except for LWJGL.
So… maybe the thing to do is write another library that makes use of JInput, but can lock and unlock the cursor – or use java.awt.Robot.mouseMove() on platforms where this is unavailable. Then I wrap JInput’s mouse functionality in my own Mouse class, and use everything else in JInput as is. Since the Mac is the main platform on which the Robot approach causes problems, this would be a portable and environmentally friendly approach.
No need to pollute.
Sorry Ken I 100% disagree.
A cursor is not an input device.
A cursor is a small, mobile video plane. (or a sofwtare simulation of such a plane.)
And thus control of it belongs in video support and NOT in input.
The confusion comes because so many windowing systems DO confuse input and output badly in this area. I strongly dislike introducing the same confusion into JInput.
As the issue is not really the input hardware (the mouse) or the output hardware (the cursor) but really a connection (mouse to cursor) that is an artifact of the WIndowing system, it really belongs in the API that controls the windowing system, which is AWT.
Proposal: Given that I firmly believe this is not a proper peice of JInput functionality, but that I ALSO recognize the need for it.
I propose we add it to JInput2, BUT we put it in the JUtils package tree and that we document in the Javadocs that this is properly AWT functionality and the day AWT properly supports it, it will be removed…
Sweet! It works! My cursor freeze doesn’t block JInput!
This works perfectly for me (with jogl):
BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
Graphics2D gfx = cursorImg.createGraphics();
gfx.setColor(new Color(0, 0, 0, 0));
gfx.fillRect(0, 0, 16, 16);
gfx.dispose();
frame.setCursor(frame.getToolkit().createCustomCursor(cursorImg, new Point(), ""));
[quote]This works perfectly for me (with jogl)
[/quote]
Hiding the cursor is easy. What we want is to immobilize the cursor.