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

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

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

GLFW.glfwSetScrollCallback介绍

[英]Sets the scroll callback of the specified window, which is called when a scrolling device is used.

The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.

This function must only be called from the main thread.
[中]设置指定窗口的滚动回调,在使用滚动设备时调用该回调。
scroll回调接收所有滚动输入,如来自鼠标滚轮或触摸板滚动区域的输入。
只能从主线程调用此函数。

代码示例

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

public void initialize() {
  glfwSetCursorPosCallback(context.getWindowHandle(), cursorPosCallback = new GLFWCursorPosCallback() {
    @Override
    public void invoke(long window, double xpos, double ypos) {
      onCursorPos(window, xpos, ypos);
    }
  });
  glfwSetScrollCallback(context.getWindowHandle(), scrollCallback = new GLFWScrollCallback() {
    @Override
    public void invoke(final long window, final double xOffset, final double yOffset) {
      onWheelScroll(window, xOffset, yOffset * WHEEL_SCALE);
    }
  });
  glfwSetMouseButtonCallback(context.getWindowHandle(), mouseButtonCallback = new GLFWMouseButtonCallback() {
    @Override
    public void invoke(final long window, final int button, final int action, final int mods) {
      onMouseButton(window, button, action, mods);
    }
  });
  setCursorVisible(cursorVisible);
  logger.fine("Mouse created.");
  initialized = true;
}

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

public void windowHandleChanged(long windowHandle) {
  resetPollingStates();
  GLFW.glfwSetKeyCallback(window.getWindowHandle(), keyCallback);
  GLFW.glfwSetCharCallback(window.getWindowHandle(), charCallback);
  GLFW.glfwSetScrollCallback(window.getWindowHandle(), scrollCallback);
  GLFW.glfwSetCursorPosCallback(window.getWindowHandle(), cursorPosCallback);
  GLFW.glfwSetMouseButtonCallback(window.getWindowHandle(), mouseButtonCallback);
}

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

public void windowHandleChanged(long windowHandle) {
  resetPollingStates();
  GLFW.glfwSetKeyCallback(window.getWindowHandle(), keyCallback);
  GLFW.glfwSetCharCallback(window.getWindowHandle(), charCallback);
  GLFW.glfwSetScrollCallback(window.getWindowHandle(), scrollCallback);
  GLFW.glfwSetCursorPosCallback(window.getWindowHandle(), cursorPosCallback);
  GLFW.glfwSetMouseButtonCallback(window.getWindowHandle(), mouseButtonCallback);
}

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

glfwSetScrollCallback(window, scrollCallback = new GLFWScrollCallback() {
  @Override
  public void invoke(final long window, final double xOffset, final double yOffset) {

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

/** See {@link GLFW#glfwSetScrollCallback SetScrollCallback}. */
public GLFWScrollCallback set(long window) {
  glfwSetScrollCallback(window, this);
  return this;
}

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

public GLFWInput(LWJGLPlatform plat, long window) {
 super(plat);
 this.plat = plat;
 this.window = window;
 glfwSetCharCallback(window, charCallback);
 glfwSetKeyCallback(window, keyCallback);
 glfwSetMouseButtonCallback(window, mouseBtnCallback);
 glfwSetCursorPosCallback(window, cursorPosCallback);
 glfwSetScrollCallback(window, scrollCallback);
}

代码示例来源: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: org.jmonkeyengine/jme3-lwjgl3

glfwSetScrollCallback(context.getWindowHandle(), scrollCallback = new GLFWScrollCallback() {
  @Override
  public void invoke(final long window, final double xOffset, final double yOffset) {

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

public void windowHandleChanged(long windowHandle) {
  resetPollingStates();
  GLFW.glfwSetKeyCallback(window.getWindowHandle(), keyCallback);
  GLFW.glfwSetCharCallback(window.getWindowHandle(), charCallback);
  GLFW.glfwSetScrollCallback(window.getWindowHandle(), scrollCallback);
  GLFW.glfwSetCursorPosCallback(window.getWindowHandle(), cursorPosCallback);
  GLFW.glfwSetMouseButtonCallback(window.getWindowHandle(), mouseButtonCallback);
}

代码示例来源:origin: Renanse/Ardor3D

GLFW.glfwSetScrollCallback(_canvas.getWindowId(), _scrollCallback = new GLFWScrollCallback() {
  double wheelAccum = 0.0;

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

glfwSetKeyCallback(handle, glfwKeyCallback);
glfwSetMouseButtonCallback(handle, glfwMouseButtonCallback);
glfwSetScrollCallback(handle, glfwScrollCallback);
glfwSetWindowCloseCallback(handle, glfwWindowCloseCallback);
glfwSetWindowFocusCallback(handle, glfwWindowFocusCallback);

代码示例来源:origin: SpinyOwl/legui

/**
 * Used to bind callbacks to OpenGL window. This method could be called only from main thread (Main OpenGL thread).
 *
 * @param window window to bind.
 * @param keeper callback keeper with callbacks.
 */
static void registerCallbacks(long window, CallbackKeeper keeper) {
  glfwSetCharCallback(window, keeper.getChainCharCallback());
  glfwSetDropCallback(window, keeper.getChainDropCallback());
  glfwSetKeyCallback(window, keeper.getChainKeyCallback());
  glfwSetScrollCallback(window, keeper.getChainScrollCallback());
  glfwSetCharModsCallback(window, keeper.getChainCharModsCallback());
  glfwSetCursorEnterCallback(window, keeper.getChainCursorEnterCallback());
  glfwSetFramebufferSizeCallback(window, keeper.getChainFramebufferSizeCallback());
  glfwSetMouseButtonCallback(window, keeper.getChainMouseButtonCallback());
  glfwSetCursorPosCallback(window, keeper.getChainCursorPosCallback());
  glfwSetWindowCloseCallback(window, keeper.getChainWindowCloseCallback());
  glfwSetWindowFocusCallback(window, keeper.getChainWindowFocusCallback());
  glfwSetWindowIconifyCallback(window, keeper.getChainWindowIconifyCallback());
  glfwSetWindowPosCallback(window, keeper.getChainWindowPosCallback());
  glfwSetWindowRefreshCallback(window, keeper.getChainWindowRefreshCallback());
  glfwSetWindowSizeCallback(window, keeper.getChainWindowSizeCallback());
}

相关文章

GLFW类方法