Fix hidden mouse cursor.

Cursor is now properly hidden, instead of being a single black pixel.  Credits to davedes.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2014-12-20 15:10:46 -05:00
parent 169e9c192a
commit 47cf4f4af3

View File

@ -22,6 +22,7 @@ import itdelatrisu.opsu.states.Options;
import java.awt.Font; import java.awt.Font;
import java.io.File; import java.io.File;
import java.nio.IntBuffer;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
@ -144,8 +145,10 @@ public class Utils {
// set the cursor // set the cursor
try { try {
// hide the native cursor // hide the native cursor
Cursor emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null); int min = Cursor.getMinCursorSize();
container.setMouseCursor(emptyCursor, 0, 0); IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
Cursor emptyCursor = new Cursor(min, min, min/2, min/2, 1, tmp, null);
container.setMouseCursor(emptyCursor, 0, 0);
} catch (LWJGLException e) { } catch (LWJGLException e) {
Log.error("Failed to set the cursor.", e); Log.error("Failed to set the cursor.", e);
} }