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

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

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

GLFW.glfwGetWindowAttrib介绍

[英]Returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.

This function must only be called from the main thread.

Framebuffer related hints are not window attributes.

Zero is a valid value for many window and context related attributes so you cannot use a return value of zero as an indication of errors. However, this function should not fail as long as it is passed valid arguments and the library has been initialized.
[中]返回指定窗口或其OpenGL或OpenGL ES上下文的属性值。
只能从主线程调用此函数。
与帧缓冲区相关的提示不是窗口属性。
对于许多与窗口和上下文相关的属性,零是一个有效值,因此不能使用返回值零作为错误指示。但是,只要传递了有效参数且库已初始化,此函数就不应失败。

代码示例

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

/**
 * This method returns the value of an attribute of the specified window or its OpenGL context.
 *
 * @param attribute The window attribute whose value to return.
 *
 * @return The value of the attribute, or zero if an error occurred.
 */
public int getAttribute(int attribute)
{
  return glfwGetWindowAttrib(handle, attribute);
}

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

@Override
public boolean isActive() {
  // XXX: Needs more investigation
  return GLFW.glfwGetWindowAttrib(_windowId, GLFW.GLFW_FOCUSED) != 0;
}

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

/**
 * Update glfw window.
 */
public void updateGlfwWindow() {
  int[] windowWidth = {0},
    windowHeight = {0};
  int[] frameBufferWidth = {0},
    frameBufferHeight = {0};
  int[] xpos = {0},
    ypos = {0};
  glfwGetWindowSize(glfwWindow, windowWidth, windowHeight);
  glfwGetFramebufferSize(glfwWindow, frameBufferWidth, frameBufferHeight);
  glfwGetWindowPos(glfwWindow, xpos, ypos);
  update(windowWidth[0], windowHeight[0],
      frameBufferWidth[0], frameBufferHeight[0],
      xpos[0], ypos[0],
      glfwGetWindowAttrib(glfwWindow, GLFW_ICONIFIED) == GLFW_TRUE
     );
}

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

@Override protected void loop () {
  boolean wasActive = glfwGetWindowAttrib(window, GLFW_VISIBLE) > 0;
  while (!glfwWindowShouldClose(window)) {
   // notify the app if lose or regain focus (treat said as pause/resume)
   boolean newActive = glfwGetWindowAttrib(window, GLFW_VISIBLE) > 0;
   if (wasActive != newActive) {
    dispatchEvent(lifecycle, wasActive ? Lifecycle.PAUSE : Lifecycle.RESUME);
    wasActive = newActive;
   }
   // process frame, if we don't need to provide true pausing
   if (newActive || !config.truePause) {
    processFrame();
   }
   // sleep until it's time for the next frame
   glfwSwapBuffers(window);
  }
  input.shutdown();
  graphics.shutdown();
  errorCallback.close();
  glfwDestroyWindow(window);
  glfwTerminate();
 }
}

相关文章

GLFW类方法