mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Fixed lexica gui elements breaking if you rescale it with the new button. Closes #1918
This commit is contained in:
1 parent
17564633c3
commit
12112b3a65
5 files changed
+34
-28
No files matched your search
@@ -140,7 +140,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
public void onInitGui() {
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
int guiScale = mc.gameSettings.guiScale;
|
||||
if(PersistentVariableHelper.lexiconGuiScale > 0) {
|
||||
System.out.println(guiScale);
|
||||
if(PersistentVariableHelper.lexiconGuiScale > 0 && PersistentVariableHelper.lexiconGuiScale != guiScale) {
|
||||
System.out.println("diff");
|
||||
mc.gameSettings.guiScale = PersistentVariableHelper.lexiconGuiScale;
|
||||
res = new ScaledResolution(mc);
|
||||
width = res.getScaledWidth();
|
||||
@@ -217,12 +219,12 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
public final void drawScreen(int par1, int par2, float par3) {
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
int guiScale = mc.gameSettings.guiScale;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
if(PersistentVariableHelper.lexiconGuiScale > 0) {
|
||||
if(PersistentVariableHelper.lexiconGuiScale > 0 && PersistentVariableHelper.lexiconGuiScale != guiScale) {
|
||||
mc.gameSettings.guiScale = PersistentVariableHelper.lexiconGuiScale;
|
||||
float s = (float) PersistentVariableHelper.lexiconGuiScale / (float) res.getScaleFactor();
|
||||
GlStateManager.scale(s, s, s);
|
||||
@@ -234,6 +236,27 @@ public class GuiLexicon extends GuiScreen {
|
||||
par2 = sh - Mouse.getY() * sh / mc.displayHeight - 1;
|
||||
}
|
||||
|
||||
drawScreenAfterScale(par1, par2, par3);
|
||||
|
||||
mc.gameSettings.guiScale = guiScale;
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(konamiTime > 0) {
|
||||
String meme = I18n.format("botania.subtitle.way");
|
||||
GlStateManager.pushMatrix();
|
||||
int fullWidth = fontRendererObj.getStringWidth(meme);
|
||||
int left = width;
|
||||
double widthPerTick = (fullWidth + width) / 240;
|
||||
double currWidth = left - widthPerTick * (240 - (konamiTime - par3)) * 3.2;
|
||||
|
||||
GlStateManager.translate(currWidth, height / 2 - 10, 0);
|
||||
GlStateManager.scale(4, 4, 4);
|
||||
mc.fontRendererObj.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreenAfterScale(int par1, int par2, float par3) {
|
||||
float time = ClientTickHandler.ticksInGame + par3;
|
||||
timeDelta = time - lastTime;
|
||||
lastTime = time;
|
||||
@@ -299,23 +322,6 @@ public class GuiLexicon extends GuiScreen {
|
||||
drawTexturedModalRect(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT);
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
mc.gameSettings.guiScale = guiScale;
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(konamiTime > 0) {
|
||||
String meme = I18n.format("botania.subtitle.way");
|
||||
GlStateManager.pushMatrix();
|
||||
int fullWidth = fontRendererObj.getStringWidth(meme);
|
||||
int left = width;
|
||||
double widthPerTick = (fullWidth + width) / 240;
|
||||
double currWidth = left - widthPerTick * (240 - (konamiTime - par3)) * 3.2;
|
||||
|
||||
GlStateManager.translate(currWidth, height / 2 - 10, 0);
|
||||
GlStateManager.scale(4, 4, 4);
|
||||
mc.fontRendererObj.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawNotes(float part) {
|
||||
|
||||
@@ -58,8 +58,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreenAfterScale(int par1, int par2, float par3) {
|
||||
super.drawScreenAfterScale(par1, par2, par3);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
@@ -55,8 +55,8 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreenAfterScale(int par1, int par2, float par3) {
|
||||
super.drawScreenAfterScale(par1, par2, par3);
|
||||
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
|
||||
@@ -193,8 +193,8 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreenAfterScale(int par1, int par2, float par3) {
|
||||
super.drawScreenAfterScale(par1, par2, par3);
|
||||
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
page.renderScreen(this, par1, par2);
|
||||
|
||||
@@ -175,8 +175,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreenAfterScale(int par1, int par2, float par3) {
|
||||
super.drawScreenAfterScale(par1, par2, par3);
|
||||
|
||||
if(!searchField.getText().isEmpty()) {
|
||||
drawBookmark(left + 138, top + guiHeight - 24, " " + searchField.getText(), false);
|
||||
|
||||
Reference in new issue
Block a user