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. 12
      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) {
PointerIcon pointerIcon = null;
if (cursor != null) {
final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData()); final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData());
final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight()); final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight());
final PixelFormat pixFormat = PixelFormat.RGBA8888; final PixelFormat pixFormat = PixelFormat.RGBA8888;
final PixelRectangle.GenericPixelRect rec = new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels); final PixelRectangle.GenericPixelRect rec =
final PointerIcon joglCursor = component.getScreen().getDisplay().createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot()); new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels);
component.setPointerIcon(joglCursor); pointerIcon = component.getScreen().getDisplay()
.createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
}
component.setPointerIcon(pointerIcon);
} }
} }

Loading…
Cancel
Save