org.lwjgl.glfw.GLFW.glfwCreateStandardCursor()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(145)

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

GLFW.glfwCreateStandardCursor介绍

[英]Returns a cursor with a standard shape, that can be set for a window with #glfwSetCursor.

This function must only be called from the main thread.
[中]返回具有标准形状的光标,可以为具有#glfwSetCursor的窗口设置该光标。
只能从主线程调用此函数。

代码示例

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

static void setSystemCursor(long windowHandle, SystemCursor systemCursor) {
    Long glfwCursor = systemCursors.get(systemCursor);
    if (glfwCursor == null) {
      long handle = 0;
      if (systemCursor == SystemCursor.Arrow) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
      } else if (systemCursor == SystemCursor.Crosshair) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR);
      } else if (systemCursor == SystemCursor.Hand) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
      } else if (systemCursor == SystemCursor.HorizontalResize) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
      } else if (systemCursor == SystemCursor.VerticalResize) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_VRESIZE_CURSOR);
      } else if (systemCursor == SystemCursor.Ibeam) {
         handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
       } else {
        throw new GdxRuntimeException("Unknown system cursor " + systemCursor);
      }

      if (handle == 0) {
        return;
      }
      glfwCursor = handle;
      systemCursors.put(systemCursor, glfwCursor);
    }
    GLFW.glfwSetCursor(windowHandle, glfwCursor);
  }
}

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

static void setSystemCursor(long windowHandle, SystemCursor systemCursor) {
    Long glfwCursor = systemCursors.get(systemCursor);
    if (glfwCursor == null) {
      long handle = 0;
      if (systemCursor == SystemCursor.Arrow) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
      } else if (systemCursor == SystemCursor.Crosshair) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR);
      } else if (systemCursor == SystemCursor.Hand) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
      } else if (systemCursor == SystemCursor.HorizontalResize) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
      } else if (systemCursor == SystemCursor.VerticalResize) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_VRESIZE_CURSOR);
      } else if (systemCursor == SystemCursor.Ibeam) {
         handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
       } else {
        throw new GdxRuntimeException("Unknown system cursor " + systemCursor);
      }

      if (handle == 0) {
        return;
      }
      glfwCursor = handle;
      systemCursors.put(systemCursor, glfwCursor);
    }
    GLFW.glfwSetCursor(windowHandle, glfwCursor);
  }
}

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

static void setSystemCursor(long windowHandle, SystemCursor systemCursor) {
    Long glfwCursor = systemCursors.get(systemCursor);
    if (glfwCursor == null) {
      long handle = 0;
      if (systemCursor == SystemCursor.Arrow) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
      } else if (systemCursor == SystemCursor.Crosshair) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR);
      } else if (systemCursor == SystemCursor.Hand) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
      } else if (systemCursor == SystemCursor.HorizontalResize) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
      } else if (systemCursor == SystemCursor.VerticalResize) {
        handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_VRESIZE_CURSOR);
      } else if (systemCursor == SystemCursor.Ibeam) {
         handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
       } else {
        throw new GdxRuntimeException("Unknown system cursor " + systemCursor);
      }

      if (handle == 0) {
        return;
      }
      glfwCursor = handle;
      systemCursors.put(systemCursor, glfwCursor);
    }
    GLFW.glfwSetCursor(windowHandle, glfwCursor);
  }
}

代码示例来源:origin: sriharshachilakapati/SilenceEngine

/**
 * Constructs a cursor object that uses a predefined cursor defined by the operating system.
 *
 * @param standardType The type of the default cursor that this cursor object should look like.
 */
public Cursor(Type standardType)
{
  handle = glfwCreateStandardCursor(standardType.getType());
  if (handle == NULL)
    throw new SilenceException("Unable to load cursor from texture");
}

相关文章

GLFW类方法