'LWJGL2 bugged cursor
I've been trying to make custom cursor in LWJGL2 but it's bugged. (Also I know LWJGL2 is unsupported)
I won't lie, I found this code..
The code:
public static void loadCursor(String path) {
try{
File f = new File(path);
if(!f.exists()) return;
BufferedImage img = ImageIO.read(f);
final int w = img.getWidth();
final int h = img.getHeight();
int rgbData[] = new int[w * h];
for (int i = 0; i < rgbData.length; i++)
{
int x = i % w;
int y = h - 1 - i / w; // this will also flip the image vertically
rgbData[i] = img.getRGB(x, y);
}
IntBuffer buffer = BufferUtils.createIntBuffer(w * h);
buffer.put(rgbData);
buffer.rewind();
Cursor cursor = new Cursor(w, h, w / 2, h / 2, 1, buffer, null);
Mouse.setNativeCursor(cursor);
} catch (Exception e){
e.printStackTrace();
}
}
The problem is that some cursors are buggy
Example image1.png
Then image2.png, this cusor is working fine..
Am I doing something wrong? What could be causing this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|




