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

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

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

GLFW.glfwGetPrimaryMonitor介绍

[英]Returns the primary monitor. This is usually the monitor where elements like the task bar or global menu bar are located.

This function must only be called from the main thread.

The primary monitor is always first in the array returned by #glfwGetMonitors.
[中]返回主监视器。这通常是任务栏或全局菜单栏等元素所在的监视器。
只能从主线程调用此函数。
主监视器始终是#glfwGetMonitors返回的数组中的第一个。

代码示例

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

@Override
public Monitor getPrimaryMonitor() {
  return Lwjgl3ApplicationConfiguration.toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}

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

@Override
public Monitor getPrimaryMonitor() {
  return Lwjgl3ApplicationConfiguration.toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}

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

/**
 * @return the primary {@link Monitor}
 */
public static Monitor getPrimaryMonitor() {
  Lwjgl3Application.initializeGlfw();
  return toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}

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

/**
 * @return the primary {@link Monitor}
 */
public static Monitor getPrimaryMonitor() {
  Lwjgl3Application.initializeGlfw();
  return toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}

代码示例来源: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

/**
 * @return the available {@link DisplayMode}s of the primary monitor
 */
public static DisplayMode[] getDisplayModes() {
  Lwjgl3Application.initializeGlfw(); 
  Buffer videoModes = GLFW.glfwGetVideoModes(GLFW.glfwGetPrimaryMonitor());
  DisplayMode[] result = new DisplayMode[videoModes.limit()];
  for (int i = 0; i < result.length; i++) {
    GLFWVidMode videoMode = videoModes.get(i);
    result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
        videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
  }
  return result;
}

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

/**
 * @return the available {@link DisplayMode}s of the primary monitor
 */
public static DisplayMode[] getDisplayModes() {
  Lwjgl3Application.initializeGlfw(); 
  Buffer videoModes = GLFW.glfwGetVideoModes(GLFW.glfwGetPrimaryMonitor());
  DisplayMode[] result = new DisplayMode[videoModes.limit()];
  for (int i = 0; i < result.length; i++) {
    GLFWVidMode videoMode = videoModes.get(i);
    result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
        videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
  }
  return result;
}

代码示例来源: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

monitor = glfwGetPrimaryMonitor();
final GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

monitor = glfwGetPrimaryMonitor();
final GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

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

/**
 * This function returns the primary monitor. This is usually the monitor where elements like the Windows task bar
 * or the OS X menu bar is located.
 *
 * @return The Monitor object which represents the primary monitor of the OS.
 */
public static Monitor getPrimaryMonitor()
{
  if (primary == null)
    primary = new Monitor(glfwGetPrimaryMonitor());
  return primary;
}

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

@Override
public Monitor getPrimaryMonitor() {
  return Lwjgl3ApplicationConfiguration.toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}

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

/**
 * @return the primary {@link Monitor}
 */
public static Monitor getPrimaryMonitor() {
  Lwjgl3Application.initializeGlfw();
  return toLwjgl3Monitor(GLFW.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 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: com.badlogicgames.gdx/gdx-backend-lwjgl3

/**
 * @return the available {@link DisplayMode}s of the primary monitor
 */
public static DisplayMode[] getDisplayModes() {
  Lwjgl3Application.initializeGlfw(); 
  Buffer videoModes = GLFW.glfwGetVideoModes(GLFW.glfwGetPrimaryMonitor());
  DisplayMode[] result = new DisplayMode[videoModes.limit()];
  for (int i = 0; i < result.length; i++) {
    GLFWVidMode videoMode = videoModes.get(i);
    result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
        videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
  }
  return result;
}

代码示例来源: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));
}

相关文章

GLFW类方法