Hi!
I started playing around with the mouse in lwjgl and got a visible cursor on the screen.
My problem is that the cursor's image is somehow turned 90 degrees counter-clockwise,
while creating the Cursor.
I'll put the code where I create it.
private final static void createCursor() {
Image image = (new javax.swing.ImageIcon("cursor.png")).getImage();
// Exctract The Image
BufferedImage tex =
new BufferedImage(
image.getWidth(null),
image.getHeight(null),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D)tex.getGraphics();
g.drawImage(image, null, null);
g.dispose();
// Put Image In Memory
IntBuffer scratch =
IntBuffer.allocate(4 * tex.getWidth() * tex.getHeight());
int data[] =
(int[]) tex.getRaster().getDataElements(
0,
0,
tex.getWidth(),
tex.getHeight(),
null);
scratch.clear();
scratch.put(data);
scratch.rewind();
try {
cursor = new Cursor(tex.getWidth(), tex.getHeight(), 0, tex.getHeight(), 1,
scratch, null);
Mouse.setNativeCursor(cursor);
} catch(Exception e) {
System.err.println("Could not create cursor.");
}
}
Any ideas how I could get it the cursor's image to point to the right direction?
O.