本文整理了Java中org.lwjgl.glfw.GLFW.glfwSetWindowSize()
方法的一些代码示例,展示了GLFW.glfwSetWindowSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwSetWindowSize()
方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwSetWindowSize
[英]Sets the size, in pixels, of the client area of the specified window.
For full screen windows, this function updates the resolution of its desired video mode and switches to the video mode closest to it, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.
If you wish to update the refresh rate of the desired video mode in addition to its resolution, see #glfwSetWindowMonitor.
The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.
Notes:
代码示例来源:origin: libgdx/libgdx
@Override
public boolean setWindowedMode(int width, int height) {
window.getInput().resetPollingStates();
if (!isFullscreen()) {
GLFW.glfwSetWindowSize(window.getWindowHandle(), width, height);
} else {
if (displayModeBeforeFullscreen == null) {
storeCurrentWindowPositionAndDisplayMode();
}
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), 0,
windowPosXBeforeFullscreen, windowPosYBeforeFullscreen, width, height,
displayModeBeforeFullscreen.refreshRate);
}
updateFramebufferInfo();
return true;
}
代码示例来源:origin: libgdx/libgdx
@Override
public boolean setWindowedMode(int width, int height) {
window.getInput().resetPollingStates();
if (!isFullscreen()) {
GLFW.glfwSetWindowSize(window.getWindowHandle(), width, height);
} else {
if (displayModeBeforeFullscreen == null) {
storeCurrentWindowPositionAndDisplayMode();
}
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), 0,
windowPosXBeforeFullscreen, windowPosYBeforeFullscreen, width, height,
displayModeBeforeFullscreen.refreshRate);
}
updateFramebufferInfo();
return true;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
((OSVR)environment.getVRHardware()).getRenderSize(windowSize);
windowSize.x = Math.max(windowSize.x * 2f, leftCamera.getWidth());
org.lwjgl.glfw.GLFW.glfwSetWindowSize(window, (int)windowSize.x, (int)windowSize.y);
environment.getApplication().getContext().getSettings().setResolution((int)windowSize.x, (int)windowSize.y);
代码示例来源:origin: libgdx/libgdx
@Override
public boolean setFullscreenMode(DisplayMode displayMode) {
window.getInput().resetPollingStates();
Lwjgl3DisplayMode newMode = (Lwjgl3DisplayMode) displayMode;
if (isFullscreen()) {
Lwjgl3DisplayMode currentMode = (Lwjgl3DisplayMode) getDisplayMode();
if (currentMode.getMonitor() == newMode.getMonitor() && currentMode.refreshRate == newMode.refreshRate) {
// same monitor and refresh rate
GLFW.glfwSetWindowSize(window.getWindowHandle(), newMode.width, newMode.height);
} else {
// different monitor and/or refresh rate
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), newMode.getMonitor(),
0, 0, newMode.width, newMode.height, newMode.refreshRate);
}
} else {
// store window position so we can restore it when switching from fullscreen to windowed later
storeCurrentWindowPositionAndDisplayMode();
// switch from windowed to fullscreen
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), newMode.getMonitor(),
0, 0, newMode.width, newMode.height, newMode.refreshRate);
}
updateFramebufferInfo();
return true;
}
代码示例来源:origin: libgdx/libgdx
@Override
public boolean setFullscreenMode(DisplayMode displayMode) {
window.getInput().resetPollingStates();
Lwjgl3DisplayMode newMode = (Lwjgl3DisplayMode) displayMode;
if (isFullscreen()) {
Lwjgl3DisplayMode currentMode = (Lwjgl3DisplayMode) getDisplayMode();
if (currentMode.getMonitor() == newMode.getMonitor() && currentMode.refreshRate == newMode.refreshRate) {
// same monitor and refresh rate
GLFW.glfwSetWindowSize(window.getWindowHandle(), newMode.width, newMode.height);
} else {
// different monitor and/or refresh rate
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), newMode.getMonitor(),
0, 0, newMode.width, newMode.height, newMode.refreshRate);
}
} else {
// store window position so we can restore it when switching from fullscreen to windowed later
storeCurrentWindowPositionAndDisplayMode();
// switch from windowed to fullscreen
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), newMode.getMonitor(),
0, 0, newMode.width, newMode.height, newMode.refreshRate);
}
updateFramebufferInfo();
return true;
}
代码示例来源:origin: jsettlers/settlers-remake
public void async_set_size(int width, int height) {
GLFW.glfwSetWindowSize(glfw_wnd, width, height);
}
代码示例来源:origin: sriharshachilakapati/SilenceEngine
/**
* <p> This method sets the size, in screen coordinates, of the client area of this window.</p>
*
* <p> For full screen windows, this method selects and switches to the resolution closest to the specified size,
* without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain
* unchanged.</p>
*
* <p> The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these
* limits.</p>
*
* @param size The new size of the client area of this window, in screen coordinates, as a Vector2.
*/
public void setSize(Vector2 size)
{
this.size.set(size);
glfwSetWindowSize(handle, (int) size.x, (int) size.y);
}
代码示例来源:origin: fynnfluegge/oreon-engine
public void resize(int width, int height) {
glfwSetWindowSize(getId(), width, height);
setHeight(height);
setWidth(width);
BaseContext.getConfig().setWindowWidth(width);
BaseContext.getConfig().setWindowHeight(height);
// TODO set camera projection
}
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3
@Override
public boolean setWindowedMode(int width, int height) {
window.getInput().resetPollingStates();
if (!isFullscreen()) {
GLFW.glfwSetWindowSize(window.getWindowHandle(), width, height);
} else {
if (displayModeBeforeFullscreen == null) {
storeCurrentWindowPositionAndDisplayMode();
}
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), 0,
windowPosXBeforeFullscreen, windowPosYBeforeFullscreen, width, height,
displayModeBeforeFullscreen.refreshRate);
}
updateFramebufferInfo();
return true;
}
代码示例来源: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: com.badlogicgames.gdx/gdx-backend-lwjgl3
@Override
public boolean setFullscreenMode(DisplayMode displayMode) {
window.getInput().resetPollingStates();
Lwjgl3DisplayMode newMode = (Lwjgl3DisplayMode) displayMode;
if (isFullscreen()) {
Lwjgl3DisplayMode currentMode = (Lwjgl3DisplayMode) getDisplayMode();
if (currentMode.getMonitor() == newMode.getMonitor() && currentMode.refreshRate == newMode.refreshRate) {
// same monitor and refresh rate
GLFW.glfwSetWindowSize(window.getWindowHandle(), newMode.width, newMode.height);
} else {
// different monitor and/or refresh rate
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), newMode.getMonitor(),
0, 0, newMode.width, newMode.height, newMode.refreshRate);
}
} else {
// store window position so we can restore it when switching from fullscreen to windowed later
storeCurrentWindowPositionAndDisplayMode();
// switch from windowed to fullscreen
GLFW.glfwSetWindowMonitor(window.getWindowHandle(), newMode.getMonitor(),
0, 0, newMode.width, newMode.height, newMode.refreshRate);
}
updateFramebufferInfo();
return true;
}
内容来源于网络,如有侵权,请联系作者删除!