Package com.mojang.blaze3d.platform
Class Window
java.lang.Object
com.mojang.blaze3d.platform.Window
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanstatic final intstatic final intprivate final org.lwjgl.glfw.GLFWErrorCallbackprivate booleanprivate Stringprivate final WindowEventHandlerprivate intprivate intprivate intprivate booleanprivate doubleprivate intprivate intprivate intprivate static final org.slf4j.Loggerprivate final ScreenManagerprivate booleanprivate intprivate final longprivate intprivate intprivate intprivate intprivate intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionWindow(WindowEventHandler eventHandler, ScreenManager screenManager, DisplayData displayData, String preferredFullscreenVideoMode, String title) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidbootCrash(int error, long description) intcalculateScale(int guiScale, boolean forceUnicode) voidstatic voidcheckGlfwError(BiConsumer<Integer, String> errorConsumer) voidclose()voiddefaultErrorCallback(int error, long description) intdoubleintintintstatic StringintintintintgetWidth()longintgetX()intgetY()booleanprivate voidonEnter(long window, boolean cursorEntered) private voidonFocus(long window, boolean hasFocus) private voidonFramebufferResize(long window, int framebufferWidth, int framebufferHeight) private voidonMove(long window, int x, int y) private voidonResize(long window, int width, int height) private voidprivate voidvoidvoidsetErrorSection(String errorSection) voidsetFramerateLimit(int limit) voidsetGuiScale(double scaleFactor) voidsetHeight(int framebufferHeight) voidsetIcon(PackResources packResources, IconSet iconSet) private voidsetMode()voidsetPreferredFullscreenVideoMode(Optional<VideoMode> preferredFullscreenVideoMode) voidvoidsetWidth(int framebufferWidth) voidsetWindowed(int windowedWidth, int windowedHeight) booleanvoidvoidprivate voidupdateFullscreen(boolean vsyncEnabled) voidupdateRawMouseInput(boolean enableRawMouseMotion) voidupdateVsync(boolean vsync)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
BASE_WIDTH
public static final int BASE_WIDTH- See Also:
-
BASE_HEIGHT
public static final int BASE_HEIGHT- See Also:
-
defaultErrorCallback
private final org.lwjgl.glfw.GLFWErrorCallback defaultErrorCallback -
eventHandler
-
screenManager
-
window
private final long window -
windowedX
private int windowedX -
windowedY
private int windowedY -
windowedWidth
private int windowedWidth -
windowedHeight
private int windowedHeight -
preferredFullscreenVideoMode
-
fullscreen
private boolean fullscreen -
actuallyFullscreen
private boolean actuallyFullscreen -
x
private int x -
y
private int y -
width
private int width -
height
private int height -
framebufferWidth
private int framebufferWidth -
framebufferHeight
private int framebufferHeight -
guiScaledWidth
private int guiScaledWidth -
guiScaledHeight
private int guiScaledHeight -
guiScale
private double guiScale -
errorSection
-
dirty
private boolean dirty -
framerateLimit
private int framerateLimit -
vsync
private boolean vsync
-
-
Constructor Details
-
Window
public Window(WindowEventHandler eventHandler, ScreenManager screenManager, DisplayData displayData, @Nullable String preferredFullscreenVideoMode, String title)
-
-
Method Details
-
getPlatform
-
getRefreshRate
public int getRefreshRate() -
shouldClose
public boolean shouldClose() -
checkGlfwError
-
setIcon
- Throws:
IOException
-
setErrorSection
-
setBootErrorCallback
private void setBootErrorCallback() -
bootCrash
private static void bootCrash(int error, long description) -
defaultErrorCallback
public void defaultErrorCallback(int error, long description) -
setDefaultErrorCallback
public void setDefaultErrorCallback() -
updateVsync
public void updateVsync(boolean vsync) -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
onMove
private void onMove(long window, int x, int y) -
onFramebufferResize
private void onFramebufferResize(long window, int framebufferWidth, int framebufferHeight) -
refreshFramebufferSize
private void refreshFramebufferSize() -
onResize
private void onResize(long window, int width, int height) -
onFocus
private void onFocus(long window, boolean hasFocus) -
onEnter
private void onEnter(long window, boolean cursorEntered) - Parameters:
cursorEntered-trueif the cursor entered the window,falseif the cursor left
-
setFramerateLimit
public void setFramerateLimit(int limit) -
getFramerateLimit
public int getFramerateLimit() -
updateDisplay
public void updateDisplay() -
getPreferredFullscreenVideoMode
-
setPreferredFullscreenVideoMode
-
changeFullscreenVideoMode
public void changeFullscreenVideoMode() -
setMode
private void setMode() -
toggleFullScreen
public void toggleFullScreen() -
setWindowed
public void setWindowed(int windowedWidth, int windowedHeight) -
updateFullscreen
private void updateFullscreen(boolean vsyncEnabled) -
calculateScale
public int calculateScale(int guiScale, boolean forceUnicode) -
setGuiScale
public void setGuiScale(double scaleFactor) -
setTitle
-
getWindow
public long getWindow() -
isFullscreen
public boolean isFullscreen() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
setWidth
public void setWidth(int framebufferWidth) -
setHeight
public void setHeight(int framebufferHeight) -
getScreenWidth
public int getScreenWidth() -
getScreenHeight
public int getScreenHeight() -
getGuiScaledWidth
public int getGuiScaledWidth() -
getGuiScaledHeight
public int getGuiScaledHeight() -
getX
public int getX() -
getY
public int getY() -
getGuiScale
public double getGuiScale() -
findBestMonitor
-
updateRawMouseInput
public void updateRawMouseInput(boolean enableRawMouseMotion)
-