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 class
Window.GlErroredException
-
Field Summary
Fields Modifier and Type Field Description private boolean
currentFullscreen
private GLFWErrorCallback
errorCallback
private WindowEventHandler
eventHandler
private int
framebufferHeight
private int
framebufferWidth
private int
framerateLimit
private boolean
fullscreen
private long
handle
private int
height
private static Logger
LOGGER
private MonitorTracker
monitorTracker
private String
phase
private int
scaledHeight
private int
scaledWidth
private double
scaleFactor
private Optional<VideoMode>
videoMode
private boolean
videoModeDirty
private boolean
vsync
private int
width
private int
windowedHeight
private int
windowedWidth
private int
windowedX
private int
windowedY
private int
x
private int
y
-
Constructor Summary
Constructors Constructor Description Window(WindowEventHandler eventHandler, MonitorTracker monitorTracker, WindowSettings settings, String videoMode, String title)
-
Method Summary
Modifier and Type Method Description static void
acceptError(BiConsumer<Integer,String> consumer)
void
applyVideoMode()
int
calculateScaleFactor(int guiScale, boolean forceUnicodeFont)
void
close()
int
getFramebufferHeight()
int
getFramebufferWidth()
int
getFramerateLimit()
long
getHandle()
int
getHeight()
Monitor
getMonitor()
int
getRefreshRate()
int
getScaledHeight()
int
getScaledWidth()
double
getScaleFactor()
Optional<VideoMode>
getVideoMode()
int
getWidth()
int
getX()
int
getY()
boolean
isFullscreen()
void
logGlError(int error, long description)
void
logOnGlError()
private void
onCursorEnterChanged(long window, boolean entered)
private void
onFramebufferSizeChanged(long window, int width, int height)
private void
onWindowFocusChanged(long window, boolean focused)
private void
onWindowPosChanged(long window, int x, int y)
private void
onWindowSizeChanged(long window, int width, int height)
private ByteBuffer
readImage(InputStream in, IntBuffer x, IntBuffer y, IntBuffer channels)
void
setFramerateLimit(int framerateLimit)
void
setIcon(InputStream icon16, InputStream icon32)
void
setPhase(String phase)
void
setRawMouseMotion(boolean rawMouseMotion)
void
setScaleFactor(double scaleFactor)
void
setTitle(String title)
void
setVideoMode(Optional<VideoMode> videoMode)
void
setVsync(boolean vsync)
boolean
shouldClose()
void
swapBuffers()
private static void
throwGlError(int error, long description)
private void
throwOnGlError()
void
toggleFullscreen()
private void
updateFramebufferSize()
private void
updateFullscreen(boolean vsync)
private void
updateWindowRegion()
-
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:
close
in 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)
-