Class Window
java.lang.Object
com.mojang.blaze3d.platform.Window
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanstatic final intstatic final intprivate CursorTypeprivate final org.lwjgl.glfw.GLFWErrorCallbackprivate booleanprivate Stringprivate final WindowEventHandlerprivate intprivate intprivate booleanprivate intprivate intprivate intprivate final longprivate intprivate booleanprivate static final org.slf4j.Loggerprivate booleanprivate final ScreenManagerprivate booleanprivate intprivate intprivate intprivate intprivate intprivate intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionWindow(WindowEventHandler eventHandler, DisplayData displayData, @Nullable String fullscreenVideoModeString, String title, GpuBackend[] backends, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidbootCrash(int error, long description) intcalculateScale(int maxScale, boolean enforceUnicode) voidstatic voidcheckGlfwError(BiConsumer<Integer, String> errorConsumer) voidclose()voiddefaultErrorCallback(int errorCode, long description) @Nullable Monitorfloatintintintintstatic StringintintintintgetWidth()intgetX()intgetY()longhandle()private WindowAndDeviceinitializeBackend(GpuBackend[] backends, int width, int height, String title, long initialMonitor, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions) booleanbooleanbooleanprivate voidonEnter(long handle, boolean entered) private voidonFocus(long handle, boolean focused) private voidonFramebufferResize(long handle, int newWidth, int newHeight) private voidonIconify(long handle, boolean iconified) private voidonMove(long handle, int x, int y) private voidonResize(long handle, int newWidth, int newHeight) private voidvoidselectCursor(CursorType cursor) voidsetAllowCursorChanges(boolean value) private voidvoidvoidsetErrorSection(String string) voidsetGuiScale(int guiScale) voidsetHeight(int height) voidsetIcon(PackResources resources, IconSet iconSet) private voidsetMode()voidsetPreferredFullscreenVideoMode(Optional<VideoMode> preferredFullscreenVideoMode) voidvoidsetWidth(int width) voidvoidsetWindowed(int width, int height) booleanvoidvoidupdateDisplay(@Nullable TracyFrameCapture tracyFrameCapture) private voidupdateFullscreen(boolean enableVsync, @Nullable TracyFrameCapture tracyFrameCapture) voidupdateRawMouseInput(boolean value) voidupdateVsync(boolean enableVsync)
-
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
-
handle
private final long handle -
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 int guiScale -
errorSection
-
dirty
private boolean dirty -
vsync
private boolean vsync -
iconified
private boolean iconified -
minimized
private boolean minimized -
allowCursorChanges
private boolean allowCursorChanges -
currentCursor
-
-
Constructor Details
-
Window
public Window(WindowEventHandler eventHandler, DisplayData displayData, @Nullable String fullscreenVideoModeString, String title, GpuBackend[] backends, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions)
-
-
Method Details
-
initializeBackend
private WindowAndDevice initializeBackend(GpuBackend[] backends, int width, int height, String title, long initialMonitor, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions) -
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 errorCode, long description) -
setDefaultErrorCallback
public void setDefaultErrorCallback() -
updateVsync
public void updateVsync(boolean enableVsync) -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
onMove
private void onMove(long handle, int x, int y) -
onFramebufferResize
private void onFramebufferResize(long handle, int newWidth, int newHeight) -
refreshFramebufferSize
private void refreshFramebufferSize() -
onResize
private void onResize(long handle, int newWidth, int newHeight) -
onFocus
private void onFocus(long handle, boolean focused) -
onEnter
private void onEnter(long handle, boolean entered) - Parameters:
entered-trueif the cursor entered the window,falseif the cursor left
-
onIconify
private void onIconify(long handle, boolean iconified) -
updateDisplay
-
getPreferredFullscreenVideoMode
-
setPreferredFullscreenVideoMode
-
changeFullscreenVideoMode
public void changeFullscreenVideoMode() -
setMode
private void setMode() -
toggleFullScreen
public void toggleFullScreen() -
setWindowed
public void setWindowed(int width, int height) -
updateFullscreen
-
calculateScale
public int calculateScale(int maxScale, boolean enforceUnicode) -
setGuiScale
public void setGuiScale(int guiScale) -
setTitle
-
handle
public long handle() -
isFullscreen
public boolean isFullscreen() -
isIconified
public boolean isIconified() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
setWidth
public void setWidth(int width) -
setHeight
public void setHeight(int height) -
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 int getGuiScale() -
findBestMonitor
-
updateRawMouseInput
public void updateRawMouseInput(boolean value) -
setWindowCloseCallback
-
isMinimized
public boolean isMinimized() -
setAllowCursorChanges
public void setAllowCursorChanges(boolean value) -
selectCursor
-
getAppropriateLineWidth
public float getAppropriateLineWidth()
-