Resizing BS!
This commit is contained in:
parent
fb6a578d1c
commit
e18721a4db
File diff suppressed because one or more lines are too long
|
@ -244,6 +244,20 @@ public final class Minecraft implements Runnable {
|
|||
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);
|
||||
if(!this.online) {
|
||||
|
|
26
src/teavm/java/com/mojang/minecraft/ScaledResolution.java
Normal file
26
src/teavm/java/com/mojang/minecraft/ScaledResolution.java
Normal 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;
|
||||
}
|
|
@ -74,6 +74,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;
|
||||
this.fontRenderer = var1.fontRenderer;
|
||||
|
|
Loading…
Reference in New Issue
Block a user