From f10046f075efd7e17336a7b4629d446283b5c953 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Thu, 5 Aug 2021 12:35:15 +0900 Subject: - Remove GlStateManager.pushAttrib, which causes .... a lot of problems = Black screen hopefully fixed? - Mechanic Browser Rewrite --- .../dungeonsguide/gui/elements/MCollapsable.java | 4 ++-- .../dungeonsguide/gui/elements/MPanelScaledGUI.java | 20 ++++++++++---------- .../dungeonsguide/gui/elements/MTooltip.java | 19 ++++++++++--------- 3 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements') 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(); } } -- cgit