Package net.minecraft.client.util
Class Window
java.lang.Object
net.minecraft.client.util.Window
- All Implemented Interfaces:
AutoCloseable
@Environment(CLIENT) public final class Window extends Object implements AutoCloseable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWindow.GlErroredException -
Field Summary
Fields Modifier and Type Field Description private booleancurrentFullscreenprivate GLFWErrorCallbackerrorCallbackprivate WindowEventHandlereventHandlerprivate intframebufferHeightprivate intframebufferWidthprivate intframerateLimitprivate booleanfullscreenprivate longhandleprivate intheightprivate static LoggerLOGGERprivate MonitorTrackermonitorTrackerprivate Stringphaseprivate intscaledHeightprivate intscaledWidthprivate doublescaleFactorprivate Optional<VideoMode>videoModeprivate booleanvideoModeDirtyprivate booleanvsyncprivate intwidthprivate intwindowedHeightprivate intwindowedWidthprivate intwindowedXprivate intwindowedYprivate intxprivate inty -
Constructor Summary
Constructors Constructor Description Window(WindowEventHandler eventHandler, MonitorTracker monitorTracker, WindowSettings settings, String videoMode, String title) -
Method Summary
Modifier and Type Method Description static voidacceptError(BiConsumer<Integer,String> consumer)voidapplyVideoMode()intcalculateScaleFactor(int guiScale, boolean forceUnicodeFont)voidclose()intgetFramebufferHeight()intgetFramebufferWidth()intgetFramerateLimit()longgetHandle()intgetHeight()MonitorgetMonitor()intgetRefreshRate()intgetScaledHeight()intgetScaledWidth()doublegetScaleFactor()Optional<VideoMode>getVideoMode()intgetWidth()intgetX()intgetY()booleanisFullscreen()voidlogGlError(int error, long description)voidlogOnGlError()private voidonCursorEnterChanged(long window, boolean entered)private voidonFramebufferSizeChanged(long window, int width, int height)private voidonWindowFocusChanged(long window, boolean focused)private voidonWindowPosChanged(long window, int x, int y)private voidonWindowSizeChanged(long window, int width, int height)private ByteBufferreadImage(InputStream in, IntBuffer x, IntBuffer y, IntBuffer channels)voidsetFramerateLimit(int framerateLimit)voidsetIcon(InputStream icon16, InputStream icon32)voidsetPhase(String phase)voidsetRawMouseMotion(boolean rawMouseMotion)voidsetScaleFactor(double scaleFactor)voidsetTitle(String title)voidsetVideoMode(Optional<VideoMode> videoMode)voidsetVsync(boolean vsync)booleanshouldClose()voidswapBuffers()private static voidthrowGlError(int error, long description)private voidthrowOnGlError()voidtoggleFullscreen()private voidupdateFramebufferSize()private voidupdateFullscreen(boolean vsync)private voidupdateWindowRegion()
-
Field Details
-
LOGGER
-
errorCallback
-
eventHandler
-
monitorTracker
-
handle
private final long handle -
windowedX
private int windowedX -
windowedY
private int windowedY -
windowedWidth
private int windowedWidth -
windowedHeight
private int windowedHeight -
videoMode
-
fullscreen
private boolean fullscreen -
currentFullscreen
private boolean currentFullscreen -
x
private int x -
y
private int y -
width
private int width -
height
private int height -
framebufferWidth
private int framebufferWidth -
framebufferHeight
private int framebufferHeight -
scaledWidth
private int scaledWidth -
scaledHeight
private int scaledHeight -
scaleFactor
private double scaleFactor -
phase
-
videoModeDirty
private boolean videoModeDirty -
framerateLimit
private int framerateLimit -
vsync
private boolean vsync
-
-
Constructor Details
-
Window
public Window(WindowEventHandler eventHandler, MonitorTracker monitorTracker, WindowSettings settings, @Nullable String videoMode, String title)
-
-
Method Details
-
getRefreshRate
public int getRefreshRate() -
shouldClose
public boolean shouldClose() -
acceptError
-
setIcon
-
readImage
@Nullable private ByteBuffer readImage(InputStream in, IntBuffer x, IntBuffer y, IntBuffer channels) throws IOException- Throws:
IOException
-
setPhase
-
throwOnGlError
private void throwOnGlError() -
throwGlError
private static void throwGlError(int error, long description) -
logGlError
public void logGlError(int error, long description) -
logOnGlError
public void logOnGlError() -
setVsync
public void setVsync(boolean vsync) -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
onWindowPosChanged
private void onWindowPosChanged(long window, int x, int y) -
onFramebufferSizeChanged
private void onFramebufferSizeChanged(long window, int width, int height) -
updateFramebufferSize
private void updateFramebufferSize() -
onWindowSizeChanged
private void onWindowSizeChanged(long window, int width, int height) -
onWindowFocusChanged
private void onWindowFocusChanged(long window, boolean focused) -
onCursorEnterChanged
private void onCursorEnterChanged(long window, boolean entered) -
setFramerateLimit
public void setFramerateLimit(int framerateLimit) -
getFramerateLimit
public int getFramerateLimit() -
swapBuffers
public void swapBuffers() -
getVideoMode
-
setVideoMode
-
applyVideoMode
public void applyVideoMode() -
updateWindowRegion
private void updateWindowRegion() -
toggleFullscreen
public void toggleFullscreen() -
updateFullscreen
private void updateFullscreen(boolean vsync) -
calculateScaleFactor
public int calculateScaleFactor(int guiScale, boolean forceUnicodeFont) -
setScaleFactor
public void setScaleFactor(double scaleFactor) -
setTitle
-
getHandle
public long getHandle() -
isFullscreen
public boolean isFullscreen() -
getFramebufferWidth
public int getFramebufferWidth() -
getFramebufferHeight
public int getFramebufferHeight() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getScaledWidth
public int getScaledWidth() -
getScaledHeight
public int getScaledHeight() -
getX
public int getX() -
getY
public int getY() -
getScaleFactor
public double getScaleFactor() -
getMonitor
-
setRawMouseMotion
public void setRawMouseMotion(boolean rawMouseMotion)
-