org.lwjgl.input.Mouse.setNativeCursor()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.lwjgl.input.Mouse.setNativeCursor()方法的一些代码示例,展示了Mouse.setNativeCursor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mouse.setNativeCursor()方法的具体详情如下:
包路径:org.lwjgl.input.Mouse
类名称:Mouse
方法名:setNativeCursor

Mouse.setNativeCursor介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public void setSystemCursor (SystemCursor systemCursor) {
  if (canvas != null && SharedLibraryLoader.isMac) {
    return;
  }
  try {
    Mouse.setNativeCursor(null);
  } catch (LWJGLException e) {
    throw new GdxRuntimeException("Couldn't set system cursor");
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void setCursor (com.badlogic.gdx.graphics.Cursor cursor) {
  if (canvas != null && SharedLibraryLoader.isMac) {
    return;
  }
  try {
    Mouse.setNativeCursor(((LwjglCursor)cursor).lwjglCursor);
  } catch (LWJGLException e) {
    throw new GdxRuntimeException("Could not set cursor image.", e);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void setCursor (com.badlogic.gdx.graphics.Cursor cursor) {
  if (canvas != null && SharedLibraryLoader.isMac) {
    return;
  }
  try {
    Mouse.setNativeCursor(((LwjglCursor)cursor).lwjglCursor);
  } catch (LWJGLException e) {
    throw new GdxRuntimeException("Could not set cursor image.", e);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void setSystemCursor (SystemCursor systemCursor) {
  if (canvas != null && SharedLibraryLoader.isMac) {
    return;
  }
  try {
    Mouse.setNativeCursor(null);
  } catch (LWJGLException e) {
    throw new GdxRuntimeException("Couldn't set system cursor");
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void setNativeCursor(JmeCursor jmeCursor) {
  try {
    Cursor newCursor = null;
    if (jmeCursor != null) {
      newCursor = cursorMap.get(jmeCursor);
      if (newCursor == null) {
        newCursor = new Cursor(
            jmeCursor.getWidth(),
            jmeCursor.getHeight(),
            jmeCursor.getXHotSpot(),
            jmeCursor.getYHotSpot(),
            jmeCursor.getNumImages(),
            jmeCursor.getImagesData(),
            jmeCursor.getImagesDelay());
        // Add to cache
        cursorMap.put(jmeCursor, newCursor);
      }
    }
    Mouse.setNativeCursor(newCursor);
  } catch (LWJGLException ex) {
    Logger.getLogger(LwjglMouseInput.class.getName()).log(Level.SEVERE, null, ex);
  }
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

@Override
public void setCursor (com.badlogic.gdx.graphics.Cursor cursor) {
  if (canvas != null && SharedLibraryLoader.isMac) {
    return;
  }
  try {
    Mouse.setNativeCursor(((LwjglCursor)cursor).lwjglCursor);
  } catch (LWJGLException e) {
    throw new GdxRuntimeException("Could not set cursor image.", e);
  }
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

@Override
public void setSystemCursor (SystemCursor systemCursor) {
  if (canvas != null && SharedLibraryLoader.isMac) {
    return;
  }
  try {
    Mouse.setNativeCursor(null);
  } catch (LWJGLException e) {
    throw new GdxRuntimeException("Couldn't set system cursor");
  }
}

代码示例来源:origin: nifty-gui/nifty-gui

@Override
 public void disable() {
  try {
   Mouse.setNativeCursor(null);
  } catch (LWJGLException e) {
   log.warning(e.getMessage());
  }
 }
}

代码示例来源:origin: nifty-gui/nifty-gui

@Override
public void enable() {
 try {
  Mouse.setNativeCursor(cursor);
 } catch (LWJGLException e) {
  log.warning(e.getMessage());
 }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
   * @see org.newdawn.slick.GameContainer#setDefaultMouseCursor()
   */
  public void setDefaultMouseCursor() {
    try {
      Mouse.setNativeCursor(null);
    } catch (LWJGLException e) {
      Log.error("Failed to reset mouse cursor", e);
    }
  }
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
public void onGuiClosed() {
  GuiIngameForge.renderCrosshairs = true;
  // Enable cursor
  try {
    Mouse.setNativeCursor(null);
  } catch (LWJGLException e) {
    VampLib.log.e("GuiPieMenu", "Could not reset cursor", e);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.lwjgl.input.Cursor, int, int)
 */
public void setMouseCursor(Cursor cursor, int hotSpotX, int hotSpotY) throws SlickException {
  try {
   Mouse.setNativeCursor(cursor);
  } catch (Throwable e) {
   Log.error("Failed to load and apply cursor.", e);
   throw new SlickException("Failed to set mouse cursor", e);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.lwjgl.input.Cursor, int, int)
 */
public void setMouseCursor(Cursor cursor, int hotSpotX, int hotSpotY) throws SlickException {
  try {
    Mouse.setNativeCursor(cursor);
  } catch (Throwable e) {
    Log.error("Failed to load and apply cursor.", e);
    throw new SlickException("Failed to set mouse cursor", e);
  }
}

代码示例来源:origin: com.ardor3d/ardor3d-lwjgl

@MainThread
public void setCursor(final MouseCursor cursor) {
  init();
  try {
    final Cursor lwjglCursor = createLwjglCursor(cursor);
    if (lwjglCursor == null || !lwjglCursor.equals(Mouse.getNativeCursor())) {
      Mouse.setNativeCursor(lwjglCursor);
    }
  } catch (final LWJGLException e) {
    throw new RuntimeException("Unable to set cursor", e);
  }
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
public void initGui() {
  this.onGuiInit();
  this.elementCount = elements.size();
  radDiff = 2D * Math.PI / elementCount;// gap in rad
  // Disable cursor
  try {
    Mouse.setNativeCursor(new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null));
  } catch (LWJGLException e) {
    VampLib.log.e("GuiPieMenu", "Failed to set empty cursor", e);
  }
  GuiIngameForge.renderCrosshairs = false;
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(java.lang.String, int, int)
 */
public void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException {
  try {
    Cursor cursor = CursorLoader.get().getCursor(ref, hotSpotX, hotSpotY);
    Mouse.setNativeCursor(cursor);
  } catch (Throwable e) {
    Log.error("Failed to load and apply cursor.", e);
    throw new SlickException("Failed to set mouse cursor", e);
  }
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

private void hideCursor() {
  Cursor emptyCursor;
  int min = org.lwjgl.input.Cursor.getMinCursorSize();
  IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
  try {
    emptyCursor = new org.lwjgl.input.Cursor(min, min, min / 2,
        min / 2, 1, tmp, null);
    Mouse.setNativeCursor(emptyCursor);
  } catch (LWJGLException e) {
    EditorLogger.printStackTrace(e);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
 */
public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
  try {
    Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
    Mouse.setNativeCursor(cursor);
  } catch (Throwable e) {
    Log.error("Failed to load and apply cursor.", e);
    throw new SlickException("Failed to set mouse cursor", e);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
 */
public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
  try {
   Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
   Mouse.setNativeCursor(cursor);
  } catch (Throwable e) {
   Log.error("Failed to load and apply cursor.", e);
   throw new SlickException("Failed to set mouse cursor", e);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
  * @see org.newdawn.slick.GameContainer#setMouseCursor(java.lang.String,
  *      int, int)
  */
public void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException {
  try {
   Cursor cursor = CursorLoader.get().getCursor(ref, hotSpotX, hotSpotY);
   Mouse.setNativeCursor(cursor);
  } catch (Throwable e) {
   Log.error("Failed to load and apply cursor.", e);
   throw new SlickException("Failed to set mouse cursor", e);
  }
}

相关文章