Esempio n. 1
0
  public static void arrowUp(Window window) {
    if (arrowUp == 0) arrowUp = loadResource("arrowUp.jpg");

    Log.log("cursors", () -> "setting to arrow");
    if (currentCursor != arrowUp)
      Glfw.glfwSetCursor(window.getGLFWWindowReference(), currentCursor = arrowUp);
  }
Esempio n. 2
0
  protected static long loadResource(String res) {
    URL arrowFile = Cursors.class.getClassLoader().getResource(res);
    String file = arrowFile.getFile();
    ByteBuffer dest = ByteBuffer.allocateDirect(3 * cursorSize * cursorSize);
    ByteBuffer destRGBA = ByteBuffer.allocateDirect(4 * cursorSize * cursorSize);
    j.decompress(file, dest, cursorSize, cursorSize);

    for (int i = 0; i < cursorSize * cursorSize; i++) {
      byte r = dest.get();
      byte g = dest.get();
      byte b = dest.get();
      destRGBA.put(r);
      destRGBA.put(g);
      destRGBA.put(b);
      destRGBA.put((byte) (255 - (b & 0xff)));
    }

    dest.rewind();
    return Glfw.glfwCreateCursor(destRGBA, cursorSize, cursorSize, 16, 16);
  }
Esempio n. 3
0
 public static void clear(Window window) {
   if (currentCursor != 0) Glfw.glfwSetCursor(window.getGLFWWindowReference(), currentCursor = 0);
 }