Remove unless window size tracking
The only thing we care about is the framebuffer size, cause that will differ between game and progress gui rendering. The window size will be the same (real) size for both.
This commit is contained in:
@@ -16,7 +16,6 @@ public class VirtualWindow implements Closeable {
|
|||||||
private final MainWindowAccessor acc;
|
private final MainWindowAccessor acc;
|
||||||
|
|
||||||
private final Framebuffer guiFramebuffer;
|
private final Framebuffer guiFramebuffer;
|
||||||
private int displayWidth, displayHeight;
|
|
||||||
private int framebufferWidth, framebufferHeight;
|
private int framebufferWidth, framebufferHeight;
|
||||||
|
|
||||||
private int gameWidth, gameHeight;
|
private int gameWidth, gameHeight;
|
||||||
@@ -27,7 +26,6 @@ public class VirtualWindow implements Closeable {
|
|||||||
this.window = mc.getWindow();
|
this.window = mc.getWindow();
|
||||||
this.acc = (MainWindowAccessor) (Object) this.window;
|
this.acc = (MainWindowAccessor) (Object) this.window;
|
||||||
|
|
||||||
updateDisplaySize();
|
|
||||||
updateFramebufferSize();
|
updateFramebufferSize();
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
@@ -85,12 +83,6 @@ public class VirtualWindow implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateSize() {
|
public void updateSize() {
|
||||||
// Check if display size has changes and force recalculate GUI framebuffer size.
|
|
||||||
if (displaySizeChanged()) {
|
|
||||||
updateDisplaySize();
|
|
||||||
acc.invokeUpdateFramebufferSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resize the GUI framebuffer if the display size changed
|
// Resize the GUI framebuffer if the display size changed
|
||||||
if (framebufferSizeChanged()) {
|
if (framebufferSizeChanged()) {
|
||||||
updateFramebufferSize();
|
updateFramebufferSize();
|
||||||
@@ -106,17 +98,6 @@ public class VirtualWindow implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean displaySizeChanged() {
|
|
||||||
int realWidth = mc.getWindow().getWidth();
|
|
||||||
int realHeight = mc.getWindow().getHeight();
|
|
||||||
if (realWidth == 0 || realHeight == 0) {
|
|
||||||
// These can be zero on Windows if minimized.
|
|
||||||
// Creating zero-sized framebuffers however will throw an error, so we never want to switch to zero values.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return displayWidth != realWidth || displayHeight != realHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean framebufferSizeChanged() {
|
private boolean framebufferSizeChanged() {
|
||||||
int realWidth = mc.getWindow().getFramebufferWidth();
|
int realWidth = mc.getWindow().getFramebufferWidth();
|
||||||
int realHeight = mc.getWindow().getFramebufferHeight();
|
int realHeight = mc.getWindow().getFramebufferHeight();
|
||||||
@@ -128,24 +109,11 @@ public class VirtualWindow implements Closeable {
|
|||||||
return framebufferWidth != realWidth || framebufferHeight != realHeight;
|
return framebufferWidth != realWidth || framebufferHeight != realHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplaySize() {
|
|
||||||
displayWidth = mc.getWindow().getWidth();
|
|
||||||
displayHeight = mc.getWindow().getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateFramebufferSize() {
|
private void updateFramebufferSize() {
|
||||||
framebufferWidth = mc.getWindow().getFramebufferWidth();
|
framebufferWidth = mc.getWindow().getFramebufferWidth();
|
||||||
framebufferHeight = mc.getWindow().getFramebufferHeight();
|
framebufferHeight = mc.getWindow().getFramebufferHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDisplayWidth() {
|
|
||||||
return displayWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDisplayHeight() {
|
|
||||||
return displayHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFramebufferWidth() {
|
public int getFramebufferWidth() {
|
||||||
return framebufferWidth;
|
return framebufferWidth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,8 +527,8 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
int mouseX = (int) mc.mouse.getX() * window.getScaledWidth() / guiWindow.getDisplayWidth();
|
int mouseX = (int) mc.mouse.getX() * window.getScaledWidth() / Math.max(window.getWidth(), 1);
|
||||||
int mouseY = (int) mc.mouse.getY() * window.getScaledHeight() / guiWindow.getDisplayHeight();
|
int mouseY = (int) mc.mouse.getY() * window.getScaledHeight() / Math.max(window.getHeight(), 1);
|
||||||
|
|
||||||
if (mc.getOverlay() != null) {
|
if (mc.getOverlay() != null) {
|
||||||
Screen orgScreen = mc.currentScreen;
|
Screen orgScreen = mc.currentScreen;
|
||||||
|
|||||||
Reference in New Issue
Block a user