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

x33g5p2x  于2022-01-19 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(135)

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

GLFW.glfwSetCursorEnterCallback介绍

[英]Sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the client area of the window.

This function must only be called from the main thread.
[中]设置指定窗口的光标边界交叉回调,当光标进入或离开窗口的客户端区域时调用该回调。
只能从主线程调用此函数。

代码示例

代码示例来源:origin: org.lwjgl.osgi/org.lwjgl.glfw

/** See {@link GLFW#glfwSetCursorEnterCallback SetCursorEnterCallback}. */
public GLFWCursorEnterCallback set(long window) {
  glfwSetCursorEnterCallback(window, this);
  return this;
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: jsettlers/settlers-remake

private void registerCallbacks() {
    GLFW.glfwSetKeyCallback(glfw_wnd, key_callback);
    GLFW.glfwSetMouseButtonCallback(glfw_wnd, mouse_callback);
    GLFW.glfwSetScrollCallback(glfw_wnd, scroll_callback);
    GLFW.glfwSetCursorEnterCallback(glfw_wnd, cursorenter_callback);
    GLFW.glfwSetCursorPosCallback(glfw_wnd, cursorpos_callback);
    GLFW.glfwSetWindowSizeCallback(glfw_wnd, size_callback);
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) {
  glfwSetCursorPosCallback(window.getWindowHandle(), (windowHandle, xpos, ypos) -> {
    currentPos.x = xpos;
    currentPos.y = ypos;
  });
  glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {
    inWindow = entered;
  });
  glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {
    leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;
    rightButtonPressed = button == GLFW_MOUSE_BUTTON_2 && action == GLFW_PRESS;
  });
}

相关文章

GLFW类方法