Java Code Examples for org.lwjgl.glfw.GLFW#glfwSetWindowSize()
The following examples show how to use
org.lwjgl.glfw.GLFW#glfwSetWindowSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Lwjgl3Mini2DxGraphics.java From mini2Dx with Apache License 2.0 | 6 votes |
@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; }
Example 2
Source File: Lwjgl3Mini2DxGraphics.java From mini2Dx with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: PanoramaHandler.java From Sandbox with GNU Lesser General Public License v3.0 | 4 votes |
public static void renderTick(boolean start) { MinecraftClient mc = MinecraftClient.getInstance(); if (takingPanorama) { if (start) { if (panoramaStep == 0) { mc.options.hudHidden = true; currentWidth = mc.getWindow().getWidth(); currentHeight = mc.getWindow().getHeight(); rotationYaw = mc.player.yaw; rotationPitch = mc.player.pitch; if (!fullscreen) GLFW.glfwSetWindowSize(MinecraftClient.getInstance().getWindow().getHandle(), panoramaSize, panoramaSize); } switch (panoramaStep) { case 1: mc.player.yaw = 180; mc.player.pitch = 0; break; case 2: mc.player.yaw = -90; mc.player.pitch = 0; break; case 3: mc.player.yaw = 0; mc.player.pitch = 0; break; case 4: mc.player.yaw = 90; mc.player.pitch = 0; break; case 5: mc.player.yaw = 180; mc.player.pitch = -90; break; case 6: mc.player.yaw = 180; mc.player.pitch = 90; break; } mc.player.prevYaw = mc.player.yaw; mc.player.prevPitch = mc.player.pitch; } else { if (panoramaStep > 0) saveScreenshot(currentDir, "panorama_" + (panoramaStep - 1) + ".png", mc.getWindow().getWidth(), mc.getWindow().getHeight(), mc.getFramebuffer()); panoramaStep++; if (panoramaStep == 7) { mc.options.hudHidden = false; takingPanorama = false; mc.player.yaw = rotationYaw; mc.player.pitch = rotationPitch; mc.player.prevYaw = mc.player.yaw; mc.player.prevPitch = mc.player.pitch; GLFW.glfwSetWindowSize(MinecraftClient.getInstance().getWindow().getHandle(), currentWidth, currentHeight); } } } }
Example 4
Source File: GLFWContextCreator.java From settlers-remake with MIT License | 2 votes |
public void async_set_size(int width, int height) { GLFW.glfwSetWindowSize(glfw_wnd, width, height); }