()
| 1564 | } |
| 1565 | |
| 1566 | public static void checkDisplayMode() { |
| 1567 | try { |
| 1568 | if (minecraft.isFullScreen()) { |
| 1569 | if (fullscreenModeChecked) { |
| 1570 | return; |
| 1571 | } |
| 1572 | |
| 1573 | fullscreenModeChecked = true; |
| 1574 | desktopModeChecked = false; |
| 1575 | DisplayMode displaymode = Display.getDisplayMode(); |
| 1576 | Dimension dimension = getFullscreenDimension(); |
| 1577 | |
| 1578 | if (dimension == null) { |
| 1579 | return; |
| 1580 | } |
| 1581 | |
| 1582 | if (displaymode.getWidth() == dimension.width && displaymode.getHeight() == dimension.height) { |
| 1583 | return; |
| 1584 | } |
| 1585 | |
| 1586 | DisplayMode displaymode1 = getDisplayMode(dimension); |
| 1587 | |
| 1588 | if (displaymode1 == null) { |
| 1589 | return; |
| 1590 | } |
| 1591 | |
| 1592 | Display.setDisplayMode(displaymode1); |
| 1593 | minecraft.displayWidth = Display.getDisplayMode().getWidth(); |
| 1594 | minecraft.displayHeight = Display.getDisplayMode().getHeight(); |
| 1595 | |
| 1596 | if (minecraft.displayWidth <= 0) { |
| 1597 | minecraft.displayWidth = 1; |
| 1598 | } |
| 1599 | |
| 1600 | if (minecraft.displayHeight <= 0) { |
| 1601 | minecraft.displayHeight = 1; |
| 1602 | } |
| 1603 | |
| 1604 | if (minecraft.currentScreen != null) { |
| 1605 | ScaledResolution scaledresolution = new ScaledResolution(minecraft); |
| 1606 | int i = scaledresolution.getScaledWidth(); |
| 1607 | int j = scaledresolution.getScaledHeight(); |
| 1608 | minecraft.currentScreen.setWorldAndResolution(minecraft, i, j); |
| 1609 | } |
| 1610 | |
| 1611 | updateFramebufferSize(); |
| 1612 | Display.setFullscreen(true); |
| 1613 | minecraft.gameSettings.updateVSync(); |
| 1614 | GlStateManager.enableTexture2D(); |
| 1615 | } else { |
| 1616 | if (desktopModeChecked) { |
| 1617 | return; |
| 1618 | } |
| 1619 | |
| 1620 | desktopModeChecked = true; |
| 1621 | fullscreenModeChecked = false; |
| 1622 | minecraft.gameSettings.updateVSync(); |
| 1623 | Display.update(); |
no test coverage detected