diff options
author | syeyoung <cyong06@naver.com> | 2021-08-05 12:35:15 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-08-05 12:46:35 +0900 |
commit | f10046f075efd7e17336a7b4629d446283b5c953 (patch) | |
tree | 09949c1dbf309c66fbfbde6765b0da4a8ebbdf7b /src/main/java/kr/syeyoung/dungeonsguide/gui | |
parent | 468463272411cec70554aed1c96a60beea38f14a (diff) | |
download | Skyblock-Dungeons-Guide-f10046f075efd7e17336a7b4629d446283b5c953.tar.gz Skyblock-Dungeons-Guide-f10046f075efd7e17336a7b4629d446283b5c953.tar.bz2 Skyblock-Dungeons-Guide-f10046f075efd7e17336a7b4629d446283b5c953.zip |
- Remove GlStateManager.pushAttrib, which causes .... a lot of problems
= Black screen hopefully fixed?
- Mechanic Browser Rewrite
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui')
5 files changed, 24 insertions, 36 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java index f086c997..086ecfed 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java @@ -61,21 +61,15 @@ public class MGui extends GuiScreen { int j = this.mc.displayHeight - Mouse.getEventY(); ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); GlStateManager.disableDepth(); - GL11.glDisable(GL11.GL_FOG); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.color(1, 1, 1, 1); GlStateManager.scale(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1.0d); mainPanel.render0(1, new Point(0,0), new Rectangle(0,0,Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight), i, j, i, j, partialTicks); - GlStateManager.popAttrib(); GlStateManager.popMatrix(); GlStateManager.enableBlend(); - GlStateManager.enableLighting(); } catch (Throwable e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java index 86333d36..d7f3223f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java @@ -121,7 +121,7 @@ public class MPanel { int relMousey = relMousey0 - getBounds().y; GlStateManager.translate(getBounds().x, getBounds().y, 5); - GlStateManager.color(1,1,1,0); + GlStateManager.color(1,1,1,1); Rectangle absBound = getBounds().getBounds(); @@ -134,16 +134,13 @@ public class MPanel { this.scale = scale; clip(clip.x, clip.y, clip.width, clip.height); - GlStateManager.pushAttrib(); + GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushAttrib(); GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB()); GlStateManager.enableBlend(); - GlStateManager.popAttrib(); GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableBlend(); @@ -151,7 +148,6 @@ public class MPanel { GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); - GlStateManager.popAttrib(); GlStateManager.popMatrix(); if (debug && lastAbsClip.contains(absMousex, absMousey)) { GL11.glDisable(GL11.GL_SCISSOR_TEST); @@ -160,15 +156,12 @@ public class MPanel { } GL11.glDisable(GL11.GL_SCISSOR_TEST); - GlStateManager.popAttrib(); Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y); for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); mPanel.render0(scale, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); - GlStateManager.popAttrib(); GlStateManager.popMatrix(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java index 85b86f40..5a0dd4ba 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java @@ -88,7 +88,7 @@ public class MCollapsable extends MPanel { GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableBlend(); @@ -105,7 +105,7 @@ public class MCollapsable extends MPanel { fr.drawString(">", 0,0, -1); - GlStateManager.popAttrib(); + GlStateManager.popMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java index 169e99b5..a9ce318b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java @@ -65,7 +65,7 @@ public class MPanelScaledGUI extends MPanel { lastParentPoint = parentPoint; GlStateManager.translate(getBounds().x, getBounds().y, 5); - GlStateManager.color(1,1,1,0); + GlStateManager.color(1,1,1,1); Rectangle absBound = getBounds().getBounds(); absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); @@ -92,16 +92,16 @@ public class MPanelScaledGUI extends MPanel { clip(clip.x, clip.y, clip.width, clip.height); - GlStateManager.pushAttrib(); + GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushAttrib(); + GuiScreen.drawRect(0,0, (int) (getBounds().width / scale), (int) (getBounds().height / scale), backgroundColor.getRGB()); GlStateManager.enableBlend(); - GlStateManager.popAttrib(); + GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableBlend(); @@ -109,20 +109,20 @@ public class MPanelScaledGUI extends MPanel { GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); - GlStateManager.popAttrib(); + GlStateManager.popMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); - GlStateManager.popAttrib(); + Point newPt = new Point((int) ((parentPoint.x + getBounds().x) / scale), (int) ((parentPoint.y + getBounds().y) / scale)); for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); + mPanel.render0(relativeScale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks); - GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } } @@ -131,7 +131,7 @@ public class MPanelScaledGUI extends MPanel { public void clip(int x, int y, int width, int height) { if (width < 0 || height < 0) return; - GL11.glScissor((int) (x * relativeScale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * relativeScale), (int)(width* relativeScale), (int) (height * relativeScale)); + GL11.glScissor((int) (x * relativeScale), Minecraft.getMinecraft().displayHeight - (int) ((y + height+1) * relativeScale), (int)((width+1)* relativeScale), (int) ((height+1) * relativeScale)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java index 89967f5b..62ff1e2f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java @@ -33,6 +33,7 @@ public class MTooltip extends MPanelScaledGUI { private MRootPanel root; public void open(MPanel component) { + if (root == null) component.openTooltip(this); } public void close() { @@ -55,7 +56,7 @@ public class MTooltip extends MPanelScaledGUI { lastParentPoint = parentPoint; GlStateManager.translate(getBounds().x, getBounds().y, 300); - GlStateManager.color(1,1,1,0); + GlStateManager.color(1,1,1,1); Rectangle absBound = getBounds().getBounds(); absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); @@ -74,33 +75,33 @@ public class MTooltip extends MPanelScaledGUI { GlStateManager.scale(this.scale, this.scale, 1); clip = new Rectangle((int) (clip.x / scale), (int) (clip.y / scale), (int) (clip.width / scale), (int) (clip.height / scale)); lastAbsClip = clip; - GlStateManager.pushAttrib(); + GL11.glEnable(GL11.GL_SCISSOR_TEST); this.relativeScale = parentScale * this.scale; clip(clip.x, clip.y, clip.width, clip.height); - GlStateManager.pushAttrib(); + GuiScreen.drawRect(0,0, (int) (getBounds().width / scale), (int) (getBounds().height / scale), backgroundColor.getRGB()); GlStateManager.enableBlend(); - GlStateManager.popAttrib(); + GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); + render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); - GlStateManager.popAttrib(); + GlStateManager.popMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); - GlStateManager.popAttrib(); + Point newPt = new Point((int) ((parentPoint.x + getBounds().x) / scale), (int) ((parentPoint.y + getBounds().y) / scale)); for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); + mPanel.render0(relativeScale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks); - GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } } |