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

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

本文整理了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

  1. static void setSystemCursor(long windowHandle, SystemCursor systemCursor) {
  2. Long glfwCursor = systemCursors.get(systemCursor);
  3. if (glfwCursor == null) {
  4. long handle = 0;
  5. if (systemCursor == SystemCursor.Arrow) {
  6. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
  7. } else if (systemCursor == SystemCursor.Crosshair) {
  8. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR);
  9. } else if (systemCursor == SystemCursor.Hand) {
  10. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
  11. } else if (systemCursor == SystemCursor.HorizontalResize) {
  12. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
  13. } else if (systemCursor == SystemCursor.VerticalResize) {
  14. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_VRESIZE_CURSOR);
  15. } else if (systemCursor == SystemCursor.Ibeam) {
  16. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
  17. } else {
  18. throw new GdxRuntimeException("Unknown system cursor " + systemCursor);
  19. }
  20. if (handle == 0) {
  21. return;
  22. }
  23. glfwCursor = handle;
  24. systemCursors.put(systemCursor, glfwCursor);
  25. }
  26. GLFW.glfwSetCursor(windowHandle, glfwCursor);
  27. }
  28. }

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

  1. static void setSystemCursor(long windowHandle, SystemCursor systemCursor) {
  2. Long glfwCursor = systemCursors.get(systemCursor);
  3. if (glfwCursor == null) {
  4. long handle = 0;
  5. if (systemCursor == SystemCursor.Arrow) {
  6. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
  7. } else if (systemCursor == SystemCursor.Crosshair) {
  8. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR);
  9. } else if (systemCursor == SystemCursor.Hand) {
  10. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
  11. } else if (systemCursor == SystemCursor.HorizontalResize) {
  12. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
  13. } else if (systemCursor == SystemCursor.VerticalResize) {
  14. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_VRESIZE_CURSOR);
  15. } else if (systemCursor == SystemCursor.Ibeam) {
  16. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
  17. } else {
  18. throw new GdxRuntimeException("Unknown system cursor " + systemCursor);
  19. }
  20. if (handle == 0) {
  21. return;
  22. }
  23. glfwCursor = handle;
  24. systemCursors.put(systemCursor, glfwCursor);
  25. }
  26. GLFW.glfwSetCursor(windowHandle, glfwCursor);
  27. }
  28. }

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

  1. static void setSystemCursor(long windowHandle, SystemCursor systemCursor) {
  2. Long glfwCursor = systemCursors.get(systemCursor);
  3. if (glfwCursor == null) {
  4. long handle = 0;
  5. if (systemCursor == SystemCursor.Arrow) {
  6. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
  7. } else if (systemCursor == SystemCursor.Crosshair) {
  8. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_CROSSHAIR_CURSOR);
  9. } else if (systemCursor == SystemCursor.Hand) {
  10. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
  11. } else if (systemCursor == SystemCursor.HorizontalResize) {
  12. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
  13. } else if (systemCursor == SystemCursor.VerticalResize) {
  14. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_VRESIZE_CURSOR);
  15. } else if (systemCursor == SystemCursor.Ibeam) {
  16. handle = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
  17. } else {
  18. throw new GdxRuntimeException("Unknown system cursor " + systemCursor);
  19. }
  20. if (handle == 0) {
  21. return;
  22. }
  23. glfwCursor = handle;
  24. systemCursors.put(systemCursor, glfwCursor);
  25. }
  26. GLFW.glfwSetCursor(windowHandle, glfwCursor);
  27. }
  28. }

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

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

相关文章

GLFW类方法