Resizing BS!

This commit is contained in:
PeytonPlayz595 2023-07-17 02:27:19 -04:00
parent fb6a578d1c
commit e18721a4db
5 changed files with 1708 additions and 1649 deletions

3306
js/app.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -243,6 +243,20 @@ public final class Minecraft implements Runnable {
hasMouse = false;
this.ungrabMouse();
}
if(this.width != GL11.parent.getClientWidth() || this.height != GL11.parent.getClientHeight()) {
this.width = GL11.parent.getClientWidth();
this.height = GL11.parent.getClientHeight();
GL11.canvas.setWidth(width);
GL11.canvas.setHeight(height);
GL11.updateDisplay();
if (currentScreen != null) {
ScaledResolution scaledresolution = new ScaledResolution(width, height);
int k = scaledresolution.getScaledWidth();
int l = scaledresolution.getScaledHeight();
currentScreen.setWorldAndResolution(this, k, l);
}
}
checkGLError("Pre render");
GL11.glEnable(3553);

View File

@ -0,0 +1,26 @@
package com.mojang.minecraft;
public class ScaledResolution {
public ScaledResolution(int i, int j) {
scaledWidth = i;
scaledHeight = j;
for (scaleFactor = 1; scaledWidth / (scaleFactor + 1) >= 320
&& scaledHeight / (scaleFactor + 1) >= 240; scaleFactor++) {
}
scaledWidth = scaledWidth / scaleFactor;
scaledHeight = scaledHeight / scaleFactor;
}
public int getScaledWidth() {
return scaledWidth;
}
public int getScaledHeight() {
return scaledHeight;
}
private int scaledWidth;
private int scaledHeight;
public int scaleFactor;
}

View File

@ -73,6 +73,15 @@ public class GuiScreen extends Screen {
}
protected void onButtonClick(Button var1) {}
public void setWorldAndResolution(Minecraft minecraft, int i, int j) {
this.minecraft = minecraft;
fontRenderer = minecraft.fontRenderer;
width = i;
height = j;
buttons.clear();
onOpen();
}
public final void open(Minecraft var1, int var2, int var3) {
this.minecraft = var1;