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

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

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

GLFW.glfwGetVideoMode介绍

[英]Returns the current video mode of the specified monitor. If you have created a full screen window for that monitor, the return value will depend on whether that window is iconified.

The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected or the library is terminated.

This function must only be called from the main thread.
[中]返回指定监视器的当前视频模式。如果已为该监视器创建了全屏窗口,则返回值将取决于该窗口是否图标化。
返回的数组由GLFW分配和释放。你不应该自己把它放出来。在指定的监视器断开连接或库终止之前,它一直有效。
只能从主线程调用此函数。

代码示例

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

/**
 * @return the currently active {@link DisplayMode} of the given monitor
 */
public static DisplayMode getDisplayMode(Monitor monitor) {
  Lwjgl3Application.initializeGlfw();
  GLFWVidMode videoMode = GLFW.glfwGetVideoMode(((Lwjgl3Monitor)monitor).monitorHandle);
  return new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(), videoMode.height(), videoMode.refreshRate(),
      videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}

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

/**
 * @return the currently active {@link DisplayMode} of the given monitor
 */
public static DisplayMode getDisplayMode(Monitor monitor) {
  Lwjgl3Application.initializeGlfw();
  GLFWVidMode videoMode = GLFW.glfwGetVideoMode(((Lwjgl3Monitor)monitor).monitorHandle);
  return new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(), videoMode.height(), videoMode.refreshRate(),
      videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}

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

/**
 * @return the currently active {@link DisplayMode} of the primary monitor
 */
public static DisplayMode getDisplayMode() {
  Lwjgl3Application.initializeGlfw();
  GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
  return new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(), videoMode.refreshRate(),
      videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}

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

/**
 * @return the currently active {@link DisplayMode} of the primary monitor
 */
public static DisplayMode getDisplayMode() {
  Lwjgl3Application.initializeGlfw();
  GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
  return new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(), videoMode.refreshRate(),
      videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}

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

if (config.windowMaxWidth > -1) windowWidth = Math.min(windowWidth, config.windowMaxWidth);
  if (config.windowMaxHeight > -1) windowHeight = Math.min(windowHeight, config.windowMaxHeight);
  GLFWVidMode vidMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
  GLFW.glfwSetWindowPos(windowHandle, vidMode.width() / 2 - windowWidth / 2, vidMode.height() / 2 - windowHeight / 2);
} else {

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

if (config.windowMaxWidth > -1) windowWidth = Math.min(windowWidth, config.windowMaxWidth);
  if (config.windowMaxHeight > -1) windowHeight = Math.min(windowHeight, config.windowMaxHeight);
  GLFWVidMode vidMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
  GLFW.glfwSetWindowPos(windowHandle, vidMode.width() / 2 - windowWidth / 2, vidMode.height() / 2 - windowHeight / 2);
} else {

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

final GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

final GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

@Override public IDimension screenSize () {
 GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
 screenSize.width = vidMode.width();
 screenSize.height = vidMode.height();
 return screenSize;
}

代码示例来源:origin: WarmfulDevelopment/LWJGL-3-Tutorial

public void createWindow(String title) {
  window = glfwCreateWindow(width, height, title, fullscreen ? glfwGetPrimaryMonitor() : 0, 0);
  
  if (window == 0) throw new IllegalStateException("Failed to create window!");
  
  if (!fullscreen) {
    GLFWVidMode vid = glfwGetVideoMode(glfwGetPrimaryMonitor());
    glfwSetWindowPos(window, (vid.width() - width) / 2, (vid.height() - height) / 2);
  }
  
  glfwShowWindow(window);
  
  glfwMakeContextCurrent(window);
  
  input = new Input(window);
  setLocalCallbacks();
}

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

/**
 * @return the currently active {@link DisplayMode} of the given monitor
 */
public static DisplayMode getDisplayMode(Monitor monitor) {
  Lwjgl3Application.initializeGlfw();
  GLFWVidMode videoMode = GLFW.glfwGetVideoMode(((Lwjgl3Monitor)monitor).monitorHandle);
  return new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(), videoMode.height(), videoMode.refreshRate(),
      videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}

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

/**
 * This function returns the current video mode of the specified monitor. If you have created a full screen window
 * for that monitor, the return value will depend on whether that window is iconified.
 *
 * @return The current {@link VideoMode} of this monitor.
 */
public VideoMode getVideoMode()
{
  GLFWVidMode mode = glfwGetVideoMode(handle);
  int width = mode.width();
  int height = mode.height();
  int redBits = mode.redBits();
  int greenBits = mode.greenBits();
  int blueBits = mode.blueBits();
  int refreshRate = mode.refreshRate();
  return new VideoMode(width, height, redBits, greenBits, blueBits, refreshRate);
}

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

/**
 * @return the currently active {@link DisplayMode} of the primary monitor
 */
public static DisplayMode getDisplayMode() {
  Lwjgl3Application.initializeGlfw();
  GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
  return new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(), videoMode.refreshRate(),
      videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}

代码示例来源:origin: badlogic/lwjgl3-maven-gradle

ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

@Override public void setSize (int width, int height, boolean fullscreen) {
 if (plat.config.fullscreen != fullscreen) {
  plat.log().warn("fullscreen cannot be changed via setSize, use config.fullscreen instead");
  return;
 }
 GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
 if (width > vidMode.width()) {
  plat.log().debug("Capping window width at desktop width: " + width + " -> " +
           vidMode.width());
  width = vidMode.width();
 }
 if (height > vidMode.height()) {
  plat.log().debug("Capping window height at desktop height: " + height + " -> " +
           vidMode.height());
  height = vidMode.height();
 }
 glfwSetWindowSize(window, width, height);
 // plat.log().info("setSize: " + width + "x" + height);
 viewSizeM.setSize(width, height);
 IntBuffer fbSize = BufferUtils.createIntBuffer(2);
 long addr = MemoryUtil.memAddress(fbSize);
 nglfwGetFramebufferSize(window, addr, addr + 4);
 viewportAndScaleChanged(fbSize.get(0), fbSize.get(1));
}

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

GLFWVidMode vidMode = glfwGetVideoMode(monitor);

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

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

相关文章

GLFW类方法