NewtMouseInput now resets mouse cursor to default image when inputManager.setMouseCursor(null) invoked

cleanup_build_scripts
saloisio 9 years ago
parent d0175a77b6
commit 05c39990ca
  1. 18
      jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java

@ -317,11 +317,17 @@ public class NewtMouseInput implements MouseInput, MouseListener {
@Override @Override
public void setNativeCursor(JmeCursor cursor) { public void setNativeCursor(JmeCursor cursor) {
final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData()); PointerIcon pointerIcon = null;
final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight()); if (cursor != null) {
final PixelFormat pixFormat = PixelFormat.RGBA8888; final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData());
final PixelRectangle.GenericPixelRect rec = new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels); final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight());
final PointerIcon joglCursor = component.getScreen().getDisplay().createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot()); final PixelFormat pixFormat = PixelFormat.RGBA8888;
component.setPointerIcon(joglCursor); final PixelRectangle.GenericPixelRect rec =
new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels);
pointerIcon = component.getScreen().getDisplay()
.createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
}
component.setPointerIcon(pointerIcon);
} }
} }

Loading…
Cancel
Save